Skip to content

ComradeFu/osspub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osspub

a npm tool that can upload files or directories to aliyun-oss server.

Please prepare an .osspub.json configuration file to configure your Appkey, and AppSecret.

.osspub.json file

{
  "accessKeyId": "yourkeyid",
  "accessKeySecret": "yourkeysecret",
}

basic usage:

npm install --save osspub
osspub ${BUCKET_NAME} ${OSS_PATH} ${YOUR_FILE_OR_DIRECTORY}

In addition, the priority of a given file can be determined in the configuration file. By default all files have infinitely high priority. If you specify the priority of certain files, these files will be uploaded after others, and they will be uploaded according to their priority. higher pri will be uploaded first.

example

{
  "files_pri":
  {
    "index.html":0,
    "index.js":1,
    "version.json":2,
  }
}

the configure file also supports file blacklisting mode:

{
  "excludes":[".DS_Store", ".svn"]
}

By default, osspub turns on the upload logging. You can turn it off with logoff = TURE

{
  "logoff":true
}

Maybe sometimes, you only want to upload the files under the first level folder. So the configuration file also provides the limits of the level. By default, the limit is 20.

{
  "nest":20
}

Osspub push files concurrently and asynchronously by using Promise.all, so that it can save handshake wait time. you can configure this concurrent number by setting the 'batch' value, the default is 10

{
  "batch":20
}

Osspub provides the ability to remove the prefix path.

{
  "remove_prefix": true
}

The tool also provides a tagging function. You can set specific tags for special files or set default tags for all files.

{
  "headers":
  {
    "some_files":{
      "x-oss-tagging": "TagA=A&TagB=B"
    },
    "default":{
      "x-default": "foo"
    }
  }
}

MIME configurations are similar to nginx configurations, see the following example.

{
  "mime": {
      "types": {
          ".sk": "text/plain"
      }
  }
}

Hope you enjoy it.

About

a npm tool can upload file or directory to aliyun-oss server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published