up is a command-line tool, which can upload your files to sftp with simple commands.
npm install -g upuse yarn/pnpm whatever you like.
up will read configuration file from up.config.json in your working directory.
You can use up --init to create a configuration file.
Below is a complete example of up.config.json:
{
"host": "your-sftp-host",
"port": 22,
"username": "your-username",
"password": "your-password",
"remotePath": "/your/remote/path",
"localPath": "/your/local/path",
"exclude": []
}host(required): the sftp hostport: the sftp port, default is22username(required): the sftp usernamepassword(required): the sftp passwordremotePath(required): the remote dir path you want to upload to, should be an absolute path.localPath(required): the local file path you want to upload, can be relative or absolute, finally this path will be resolved to an absolute pathexclude: the files you want to exclude, should be an array of string, the string should be a glob pattern, like['**/*.log', 'node_modules']
if localPath is a directory, up will upload all files in the directory, for example:
/your/local/path is a directory, and it contains files like: /your/local/path/example.txt, remotePath is /var/www/project, when upload finished, the remote file url will be /var/www/project/example.txt
if localPath is a file, up will directly upload the file to the remotePath, for example
/your/local/example.txt is a file, remotePath is /var/www/project, when upload finished, the remote file url will be /var/www/project/example.txt
up: upload files to sftp, use the working directory'sup.config.jsonas configuration file.-h, --help: output usage information-v, --version: output the version number-i, --init: create a template of configuration file in the working directory
MIT