UNPKG

2.81 kBMarkdownView Raw
1<h3 align="center">A command line tool for upload file to IPFS Cluster use the IPFS Cluster HTTP API.</h3>
2
3[![NPM Version](https://img.shields.io/npm/v/@4everlink/cli)](https://www.npmjs.org/package/@4everlink/cli)
4[![Install Size](https://packagephobia.now.sh/badge?p=@4everlink/cli)](https://packagephobia.now.sh/result?p=@4everlink/cli)
5![License](https://img.shields.io/npm/l/@4everlink/cli)
6
7
8Read this in other languages: English | [简体中文](./README_ZH-CN.md)
9## install
10
11```
12npm install -g @4everlink/cli
13```
14
15## Command
16
17```
18Usage: 4everlink [options] [command]
19
20Options:
21 -V, --version output the version number
22 -h, --help output usage information
23
24Commands:
25 config <arg> [value] set or show config for host
26 add [options] <file> upload file
27```
28### **`add`**
29```
30$ 4everlink add --help
31
32Usage: 4everlink [options] <file>
33
34upload file
35
36Options:
37 -V, --version output the version number
38 -d, --debug output extra debugging
39 -p, --path <path> wrapper dir (default: "/")
40 --host <host> ipfs cluster api host (default: "")
41 --port <port> ipfs cluster api port (default: "")
42 --showAll show all file cid
43 -t, --token <token> ipfs cluster api base auth token (default: "")
44 -r, --recursive recursive all sub dir
45 -a, --all include hidden file
46 -h, --help output usage information
47```
48output data:
49```
50{
51 path: 'web',
52 hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
53 size: 1042
54}
55```
56or use `--showAll`
57```
58[
59 {
60 path: 'web/index.html',
61 hash: 'QmZJZG6WuiKMgXw4YANsgJQE98hmahBN7icxPtx4RoDR4M',
62 size: 430
63 },
64 {
65 path: 'web/main.css',
66 hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
67 size: 6
68 },
69 {
70 path: 'web/main.js',
71 hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
72 size: 6
73 },
74 {
75 path: 'web/sub.html',
76 hash: 'QmY3Gn49Dx4ybPwZ8AQ9kFjjWRhr7Y1vVVYp5N9yyYMSg6',
77 size: 393
78 },
79 {
80 path: 'web',
81 hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
82 size: 1042
83 }
84]
85```
86
87`host`, `port`, `token` support load from config file, default config file is `~/.4everlink/conf.yaml`, for example:
88```yaml
89host: "127.0.0.1"
90port: 9094
91token: ""
92```
93The env `_4EVERLINKCONF` set custom config file path, for example:
94`export _4EVERLINKCONF=/custom/path`, the config file is `/custom/path/conf.yaml`.
95
96### **`config`**
97```
98$ 4everlink config --help
99Usage: 4everlink config [options] <arg> [value]
100
101set or show config for host
102
103Arguments:
104
105 arg the params to set, maybe host、port or token
106 value the value to set
107
108Options:
109 -h, --help output usage information
110```
111for example, set host: `4everlink config host "127.0.0.1"`; get current host: `4everlink config host `
112
113## License
114
115[MIT](LICENSE)