Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cdn-upload with all npm packages installed. Try it out:

var cdnUpload = require("cdn-upload")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cdn-upload v1.6.2

Upload files to CDN CLI Tool


Synchronize all files in your specified local directory to the CDN (currently only supports qiniu)


  $ npm install -g cdn-upload


  Usage: cdn-upload <config path> [env]

  Upload file to cdn. the default configuration path for the configuration file is config/cdn_upload.json


    -V, --version  output the version number
    -s, --sync     Make sure the local uploaded files is the same as the cdn files
    -h, --help     output usage information


    $ cdn-upload config/cdn_upload.json beta


  npm run test // run this command before ensure .env was configured and available



  "default": {
    "cachedFile": "../build/assets_cache.json",
    "localDirectory": "../public",
    "remoteDirectory": "test/public",
    "bucket": "your cdn bucket",
    "cdn": "qiniu",
    "envFile": ".env",
    "ignore": ['a.html', 'b/**/**'], // glob ignore sytax that a.html is localdirectory/a.html and b/**/** will localdirectory/b/**/**
    "concurrency": 8 // Number of concurrent processes (default: cpu count)
  "beta": {
    "remoteDirectory": "test/beta/public",
    "concurrency": 4
  "release": {
    "remoteDirectory": "test/release/public",
    "concurrency": 8
  "production": {
    "remoteDirectory": "test/production/public",
    "concurrency": 16


QINIU_ACCESS_KEY="qiniu access key"
QINIU_SECRET_KEY="qiniu secret key"

You should add .env and assets_cache.json files in .gitignore.


Bug reports and pull requests are welcome on GitHub at


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free