{ "author": { "name": "Juraj Vitko", "url": "ypocat.com" }, "name": "sshclient", "description": "SSH Client for Node.js", "keywords": [ "ssh", "client" ], "version": "0.0.4", "homepage": "http://github.com/ypocat/sshclient", "repository": { "type": "git", "url": "git://github.com/ypocat/sshclient.git" }, "main": "lib/sshclient.js", "directories": { "lib": "./lib" }, "engines": { "node": "*" }, "dependencies": { "ssh2": "*", "laeh2": "*", "async-mini": "*" }, "devDependencies": {}, "licenses": [ { "type": "MIT", "url": "https://raw.github.com/ypocat/gfms/master/license.txt" } ], "readme": "# sshclient\n\na tiny, simple but durable wrapper for the [ssh2](https://github.com/mscdex/ssh2) node.js lib.\n\nearly version, only deployment related commands are supported: `writeFile()` and `exec()`.\n\nfor the (optional) use of `_x()`, see [laeh2](https://github.com/ypocat/laeh2).\n\n## use 1\n\n```js\nvar opts = {\n\n host: 'myhost',\n port: 22,\n username: 'ubuntu',\n privateKey: fs.readFileSync('./somekey.pem'),\n\n debug: true, // optional\n console: console, // optional, allows logger overriding\n\n session: [\n { op: 'writeFile', path: '/mydir/myfile.txt', body: 'my utf8 body, or a buffer\\n' },\n { op: 'exec', command: 'chmod o+w /mydir/myfile.txt' }\n ]\n};\n\nsshclient.session(opts, _x(cb, true, function(err) {\n console.log('done');\n cb();\n}));\n\n```\n\nnotes:\n- optional for `exec()`: `canFail: true`, continue if the command fails\n- optional for `writeFile()`: `flags: 'flags'`, [see here](http://nodejs.org/docs/latest/api/fs.html#fs_fs_open_path_flags_mode_callback), e.g. `'w'` for overwrite, `'a'` for append (on `'a*'` flags, pointer is automatically positioned to the end of the file)\n- optional for `writeFile()`: `mode: 0666`, [see here](http://nodejs.org/docs/latest/api/fs.html#fs_class_fs_stats) (only the setable ones)\n\n## use 2\n\n```js\nvar opts = {\n\n host: 'myhost',\n port: 22,\n username: 'ubuntu',\n privateKey: fs.readFileSync('./somekey.pem'),\n\n debug: true, // optional\n console: console // optional, allows logger overriding\n};\n\nsshclient.session(opts, _x(cb, true, function(err, ses) {\n \n async.series([\n\n _x(null, false, function(cb) {\n ses.writeFile('/mydir/myfile.txt', 'my utf8 body, or a buffer\\n', cb);\n }),\n \n _x(null, false, function(cb) {\n ses.exec('chmod o+w /mydir/myfile.txt', cb);\n }),\n\n ], _x(cb, false, function(err) {\n ses.quit(); // need to close the session here on both error and success\n cb(err);\n }));\n\n}));\n```\nnotes:\n- optional for `writeFile()`: `flags` and `mode` (sig: `writeFile(path, bodyOrBuff, flags, mode, cb)` - see [use 1](#use-1) for explanation\n\n", "readmeFilename": "readme.md", "bugs": { "url": "https://github.com/ypocat/sshclient/issues" }, "_id": "sshclient@0.0.4", "dist": { "shasum": "c29296788446fc7fc1f4c1b8a90726071e5e2d79" }, "_from": "sshclient@", "_resolved": "https://registry.npmjs.org/sshclient/-/sshclient-0.0.4.tgz" }