@corley/sftp-file-upload
v0.0.4
Published
A simple SFTP file uploader based on SSH2 library
Downloads
3
Readme
Upload SSH2 SFTP
Using SSH2 https://github.com/mscdex/ssh2
Install it
npm i --save @corley/sftp-file-upload
npm i --save-dev @types/ssh2 @types/node
Example
import { upload } from '@corley/sftp-file-upload'
const options = {
host: "1.1.1.1",
username: "test",
password: "test",
port: 22,
}
upload(options, __dirname + '/data.txt', 'data.txt')
.then(console.log)
.catch(console.error)
In order to make it work you need to enter your credentials in the file named config.json. In this project you can see the example of how it should be in examples/config.json.dist. The other two parameters are: your local path and the remote path where the file is going to be uploaded.
Publish
Just use npm
npm run build
Then publish as npm package
npm publish --access public