mafintosh / mafintosh/ssh-exec
Can I stream a command? like tail -f file?
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 124
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Can I stream a command? like tail -f file? I am trying to use this in a web application and I want to stream output of a command to the client? like this. How can I achieve this?
export function execute(req, res) {
console.log("execute");
console.log(req.body);
var device = req.body;
try{
exec('tail -f file.txt', {
user: device.username,
host: device.ipaddress,
password: device.password
}).pipe(res);
}
catch(e){
res.error(e)
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the execute handler and the exec('tail -f file.txt') call; start by reading the package's exec API and how its returned output is exposed. Reproduce the requested streaming behavior and define completion as a documented, tested way to forward ongoing command output to res.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100