mafintosh / mafintosh/ssh-exec

Can I stream a command? like tail -f file?

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.