upload local static files to ali oss
Last updated 9 months ago by violin_wework .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @golden-unicorn/ali-oss-upload-cli 
SYNC missed versions from official npm registry.



1. Install package

npm install --save ali-oss-upload-cli

2. Add an oss config file oss.secret.json under your project's directory.

  "region": "oss-cn-shanghai",
  "bucket": "demo-static",
  "accessKeyId": "xxxxxx",
  "accessKeySecret": "xxxxxx"

you should add this secret file to .gitignore file for preventing commit.

[Option] the config file can also be a js module and you can read id and secret from process env.

module.exports = {
  region: 'oss-cn-qingdao',
  bucket: 'qgt-paper',
  accessKeyId: process.env.TEST_OSS_ID,
  accessKeySecret: process.env.TEST_OSS_SECRET,

3. Run upload command

# upload dist dir to remote `/collab-static`
oss-upload dist -o /collab-static -c config/oss.secret.json

# upload to bucket root dir
oss-upload priv/static -o / -c config/oss.secret.json

# config can be a node module
oss-uplaod priv/static -o / -c config/oss.config.js

# you can omit arg `-c` if config file in the default location: $project/oss.config.js
oss-upload dist -o '/'
# clear remote directory before uploading
oss-upload dist -o '/' -C

4. For help

oss-upload -h  # for help

Usage: oss-upload [options] <dir>


    -V, --version        output the version number
    -o, --output <dir>   remote directory
    -C, --clear          clear remote directory before uploading
    -c, --config <file>  oss config file
    -h, --help           output usage information

Current Tags

  • 1.2.1                                ...           latest (9 months ago)

1 Versions

  • 1.2.1                                ...           9 months ago
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (4)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |