{"id":13623980,"url":"https://github.com/mikeal/sequest","last_synced_at":"2025-04-05T02:12:41.484Z","repository":{"id":17788754,"uuid":"20664812","full_name":"mikeal/sequest","owner":"mikeal","description":"Simplified API for SSH and SFTP similar to request.","archived":false,"fork":false,"pushed_at":"2022-11-10T17:51:15.000Z","size":57,"stargazers_count":283,"open_issues_count":27,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-01T22:25:33.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikeal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-09T22:44:41.000Z","updated_at":"2024-01-20T04:10:12.000Z","dependencies_parsed_at":"2023-01-11T19:41:41.743Z","dependency_job_id":null,"html_url":"https://github.com/mikeal/sequest","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fsequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fsequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fsequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fsequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeal","download_url":"https://codeload.github.com/mikeal/sequest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276189,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:37.539Z","updated_at":"2025-04-05T02:12:41.469Z","avatar_url":"https://github.com/mikeal.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## Sequest -- Simple ssh client\n\n## `sequest(host[, command[, opts]])`\n\nBy default sequest will use your local `ssh-agent` to authenticate to remote hosts which should make it unnecessary to enter username, password or privateKey information.\n\n```javascript\nvar sequest = require('sequest')\nsequest('root@127.0.0.1', 'ls', function (e, stdout) {\n  if (e) throw e\n  console.log(stdout.split('\\n'))\n})\n```\n\n### Continuous mode\n\n```javascript\nvar seq = sequest('root@127.0.0.1')\nseq.pipe(process.stdout) // only necessary if you want to see the output in your terminal\nseq.write('ls -la')\nseq.write('touch testfile')\nseq.write('ls -la')\nseq.end()\n```\n\nEach command will complete before the next is sent to the server. If any command returns a non-zero exit code it will emit an error which effectively ends the stream and the processing of subsequent commands.\n\n### Connection Options\n\nAccepts all [ssh2 connection options](https://github.com/mscdex/ssh2#connection-methods), most of which are unnecessary as you can define user and host information in the host string and because `ssh-agent` authentication is used when not supplying a `privateKey`.\n\nThe most common are listed below.\n\n* **username** - \u003c _string_ \u003e - Username for authentication. **Default:** (none)\n\n* **password** - \u003c _string_ \u003e - Password for password-based user authentication. **Default:** (none)\n\n* **agent** - \u003c _string_ \u003e - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. `sequest` defaults this to `process.env.SSH_AUTH_SOCK`.\n\n* **privateKey** - \u003c _mixed_ \u003e - Buffer or string that contains a private key for key-based user authentication (OpenSSH format). **Default:** (none)\n\n* **passphrase** - \u003c _string_ \u003e - For an encrypted private key, this is the passphrase used to decrypt it. **Default:** (none)\n\n* **publicKey** - \u003c _mixed_ \u003e - Optional Buffer or string that contains a public key for key-based user authentication (OpenSSH format). If `publicKey` is not set, it will be generated from the `privateKey`. **Default:** (none)\n\n#### Custom options\n\n* **proxy** - \u003c _string_ \u003e - Host to proxy connection through. **Default:** (none) :: (e.g `root@72.9.543.901`)\n\n### Using options\n\n```javascript\nvar fs = require('fs')\nvar sequest = require('sequest')\n// Load privateKey synchronously\nvar key = fs.readFileSync(process.env.HOME + '/.ssh/id_rsa')\n\n// Callback API\nsequest('root@10.555.44.99', {\n  command: 'uptime',\n  proxy: 'root@72.9.543.901',\n  privateKey: key\n  }, function (err, stdout) {\n    if (err) console.error(err)\n    console.log(stdout)\n})\n\n// Streaming api\nvar seq = sequest('root@19.555.44.99', { proxy: 'root@72.9.543.901'})\nseq.pipe(process.stdout);\nseq.write('ifconfig')\n\n```\n\n## `.connect(host[, opts])`\n\nConvenience API for making several calls to the same host.\n\n```javascript\nvar seq = sequest.connect('root@127.0.0.1')\nseq('ls', function (e, stdout) {\n  seq('ls '+stdout.split('\\n')[0], function (e, stdout) {\n    console.log(stdout.split('\\n'))\n    seq.end() // will keep process open if you don't end it\n  })\n})\n```\n\n## `.get(host, path[, opts])`\n### get remote file\n\n```javascript\nvar reader = sequest.get('root@127.0.0.1', '/remote/path/to/file')\nreader.pipe(process.stdout)\n```\n\nAlso works with `.connect()`\n\n```javascript\nvar c = sequest.connect('root@127.0.0.1')\n  , reader = c.get('/remote/path/to/file')\n  ;\nreader.pipe(process.stdout)\n```\n\nDefault options, as defined by [ssh2](https://github.com/mscdex/ssh2#sftp-methods), are as follows:\n\n```javascript\n{ flags: 'r',\n  encoding: null,\n  mode: 0666,\n  bufferSize: 64 * 1024\n}\n```\n\n\n## `.put(host, path[, opts])`\n### write remote file\n\n```javascript\nvar writer = sequest.put('root@127.0.0.1', '/remote/path/to/file')\nfs.createReadStream('/local/path').pipe(writer)\nwriter.on('close', function () {\n  // finished writing.\n})\n```\n\nAlso works with `.connect()`\n\n```javascript\nvar c = sequest.connect('root@127.0.0.1')\n  , writer = c.put('/remote/path/to/file')\n  ;\nfs.createReadStream('/local/path').pipe(writer)\nwriter.on('close', function () {\n  // finished writing.\n})\n```\n\nDefault options, as defined by [ssh2](https://github.com/mscdex/ssh2#sftp-methods), are as follows:\n\n```javascript\n{ flags: 'w',\n  encoding: null,\n  mode: 0666,\n  autoClose: true\n}\n```\n\n## Credits\n\nThis would not be possible without [Brian White](https://github.com/mscdex)'s amazing [ssh2](https://github.com/mscdex/ssh2) module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeal%2Fsequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeal%2Fsequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeal%2Fsequest/lists"}