{"id":22202202,"url":"https://github.com/rumkin/ssh-shell","last_synced_at":"2025-03-25T00:59:26.715Z","repository":{"id":57368896,"uuid":"60846691","full_name":"rumkin/ssh-shell","owner":"rumkin","description":"SSH remote shell client implementation","archived":false,"fork":false,"pushed_at":"2016-07-07T11:38:25.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-23T11:03:19.318Z","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/rumkin.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":"2016-06-10T12:39:17.000Z","updated_at":"2019-10-03T02:02:53.000Z","dependencies_parsed_at":"2022-09-15T15:31:01.507Z","dependency_job_id":null,"html_url":"https://github.com/rumkin/ssh-shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fssh-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fssh-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fssh-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fssh-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/ssh-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245377989,"owners_count":20605377,"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-12-02T16:12:45.125Z","updated_at":"2025-03-25T00:59:26.695Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSH Shell\n\nSSH shell is a util to manage shell commands variables and manage files upload/download.\nIt has the same interface as local-shell to simplify usage.\n\n## Installation\n\nInstall via npm\n\n```\nnpm i ssh-shell\n```\n\n## Example\n\nExample of variable usage:\n```javascript\nconst SshShell = require('ssh-shell');\n\nconst shell = new SshShell({\n    username: 'user',\n    password: '********',\n    cwd: '/home/user',\n});\n\nshell.open()\n.then(() =\u003e {    \n    shell.set('NAME', 'World');\n    shell.exec('echo Hello $NAME')\n    .then(({code, io}) =\u003e {\n        if (code) {\n            throw new Error('Exit code is ' + code);\n        }\n\n        console.log(io.toString()); // -\u003e Hello World\n\n        return shell.close();\n    });\n});\n```\n\n## API\n\n### exec(cmd:String) -\u003e Promise\u003c{code,io},Error\u003e\n\nExecute command and return promised Result object.\n\n### open()\n\n_Added for compatibility with SshShell_\n\nStart session. Emit `open` event.\n\n### close()\n\n_Added for compatibility with SshShell_\n\nStop session. Emit `close` event.\n\n### uploadFile(source:String, [dest:String]) -\u003e Promise(\u003cnull,Error\u003e)\n\nUpload file from source to destination. Destination is resolving from `cwd` value. If destination not set than it replaces with source's filename.\n\n### uploadBuffer(source:Buffer, dest:string) -\u003e Promise(\u003cnull,Error\u003e)\n\nUpload data from buffer to the server.\n\n### downloadFile(source:String, [dest:String])\n\nDownload file from source into destination. If destination not set than it replaces with source's filename.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fssh-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Fssh-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fssh-shell/lists"}