node-upload-util

A node upload util, Support ftp and sftp

Usage no npm install needed!

<script type="module">
  import nodeUploadUtil from 'https://cdn.skypack.dev/node-upload-util';
</script>

README

文件上传

Build Status Coverage Status GitHub license

Install

yarn add node-upload-util
# or
yarn add global node-upload-util

Usage

  • Use in cli

cli

  • Import in your code
import { run } from 'node-upload-util';

run({
  ftp: {
    host: '1.1.1.1',
    port: 21,
    user: 'username',
    password: '123456',
    files: ['file.txt', 'dir'],
    rootPath: '/',
    destRootPath: '/home/ftp'
  },
  sftp: {
    host: '1.1.1.1',
    port: 22,
    user: 'username',
    password: '123456',
    files: ['file.txt', 'dir'],
    rootPath: '/',
    destRootPath: '/home/sftp'
  },
})

Dev

# clone code
git clone https://github.com/hangboss1761/upload-util

cd upload-util

# install dependencies
yarn

# start dev mode
yarn dev

# build for production
yarn build
  • cli
npm link

upload start

Test

yarn test
# or
yarn test:cover