|
| 1 | +# 七牛云操作工具 |
| 2 | +> 基于 [qiniu](https://github.com/qiniu/nodejs-sdk) 封装 |
| 3 | +
|
| 4 | +## 安装 |
| 5 | + |
| 6 | +从 npm 安装 |
| 7 | + |
| 8 | +```markdown |
| 9 | +$ npm install qiniu-shell --save-dev |
| 10 | +``` |
| 11 | + |
| 12 | +## 功能 |
| 13 | +- [上传](#上传) |
| 14 | +- [下载](#下载) |
| 15 | +- [删除](#删除) |
| 16 | +- [文件刷新](#文件刷新) |
| 17 | +- [目录刷新](#目录刷新) |
| 18 | +- [文件预取](#文件预取) |
| 19 | +- [查看帮助](#查看帮助) |
| 20 | + |
| 21 | +--- |
| 22 | +- **<a id="上传">上传</a>** |
| 23 | +```markdown |
| 24 | +$ cshell upload -a accessKey -s secretKey -b bucket -p prefix/ -o originDirectoryPath -f -z huan |
| 25 | +``` |
| 26 | +上传originDirectoryPath目录下文件到bucket下的prefix目录下 |
| 27 | + |
| 28 | +**options:** |
| 29 | +```markdown |
| 30 | + -a, --accessKey [value] AccessKey |
| 31 | + -s, --secretKey [value] SecretKey |
| 32 | + -b, --bucket [value] Bucket |
| 33 | + -p, --prefix [value] Prefix of files |
| 34 | + -f, --force Whether to overwrite upload. |
| 35 | + -z --zone [value] Online zone. one of "huad"、"huab"、"huan"、"beim"、"z0"、"z1"、"z2"、"na0" |
| 36 | + -o, --originDirectoryPath [value] Directory's path of the files to upload, default is "dist" |
| 37 | + -h, --help output usage information |
| 38 | +``` |
| 39 | + |
| 40 | +注:"huad"、"z0"为华东;"huab"、"z1"为华北;"huan"、"z2"为华南;"beim"、"na0"为北美 |
| 41 | + |
| 42 | +--- |
| 43 | +- **<a id="下载">下载</a>** |
| 44 | +```markdown |
| 45 | +$ cshell download -a accessKey -s secretKey -b bucket -p prefix -o originDirectoryPath -d publicDomain |
| 46 | +``` |
| 47 | +下载publicDomain或privateDomain域名下prefix开头的文件到originDirectoryPath目录 |
| 48 | + |
| 49 | +**options:** |
| 50 | +```markdown |
| 51 | + -a, --accessKey [value] AccessKey |
| 52 | + -s, --secretKey [value] SecretKey |
| 53 | + -b, --bucket [value] Bucket |
| 54 | + -d, --publicDomain [value] Public domain of bucket |
| 55 | + --privateDomain [value] Private domain of bucket. If set this, "-d" will be useless |
| 56 | + -p, --prefix [value] Prefix of files |
| 57 | + -o, --outputDirectoryPath [value] The path of the downloaded file, default is "dist" |
| 58 | + -h, --help output usage information |
| 59 | +``` |
| 60 | + |
| 61 | +--- |
| 62 | +- **<a id="删除">删除</a>** |
| 63 | +```markdown |
| 64 | +$ cshell delete -a accessKey -s secretKey -b bucket -p prefix |
| 65 | +``` |
| 66 | +删除bucket下以prefix开头的文件 |
| 67 | + |
| 68 | +**options:** |
| 69 | + |
| 70 | +```markdown |
| 71 | + -a, --accessKey [value] AccessKey |
| 72 | + -s, --secretKey [value] SecretKey |
| 73 | + -b, --bucket [value] Bucket |
| 74 | + -p, --prefix [value] Prefix of files. If don't set it, all files of buckt will be deleted. |
| 75 | + -h, --help output usage information |
| 76 | +``` |
| 77 | + |
| 78 | +--- |
| 79 | +- **<a id="文件刷新">文件刷新</a>** |
| 80 | + |
| 81 | +1.使用cmd |
| 82 | +```markdown |
| 83 | +$ cshell refresh -a accessKey -s secretKey -u https://xxx/demo/a.js,https://xxx/demo/b.js |
| 84 | +``` |
| 85 | +<p> |
| 86 | + 刷新https://xxx/demo/a.js, https://xxx/demo/b.js 两个文件 |
| 87 | +</p> |
| 88 | + |
| 89 | + |
| 90 | +2.使用配置文件 |
| 91 | +```markdown |
| 92 | +$ cshell refresh -a accessKey -s secretKey -c ./refreshFiles.js |
| 93 | +``` |
| 94 | + |
| 95 | +refreshFiles.js:(CommonJs;String or Array) |
| 96 | +```js |
| 97 | +module.exports = ['https://xxx/demo/a.js','https://xxx/demo/b.js' ] |
| 98 | +``` |
| 99 | + |
| 100 | +<p> |
| 101 | + 刷新https://xxx/demo/a.js, https://xxx/demo/b.js 两个文件. |
| 102 | +</p> |
| 103 | + |
| 104 | + |
| 105 | +**options:** |
| 106 | + |
| 107 | +```markdown |
| 108 | + -a, --accessKey [value] AccessKey |
| 109 | + -s, --secretKey [value] SecretKey |
| 110 | + -u, --urls [value] Urls of refresh files. Split by "," |
| 111 | + -c, --configFile [path] Path of refresh urls file. If set this, "-u" will be useless |
| 112 | + -h, --help output usage information |
| 113 | +``` |
| 114 | + |
| 115 | +--- |
| 116 | +- **<a id="目录刷新">目录刷新</a>** |
| 117 | + |
| 118 | +操作同文件刷新,命令为: refreshDir |
| 119 | + |
| 120 | +--- |
| 121 | +- **<a id="文件预取">文件预取</a>** |
| 122 | + |
| 123 | +操作同文件刷新,命令为: prefetch |
| 124 | + |
| 125 | +--- |
| 126 | +- **<a id="查看帮助">查看帮助</a>** |
| 127 | + |
| 128 | +```markdown |
| 129 | +$ cshell -h |
| 130 | +$ cshell [command] -h |
| 131 | +``` |
0 commit comments