1 | <h3 align="center">使用IPFS Cluster HTTP API上传文件到IPFS集群.</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 | 使用其他语言阅读: [English](./README.md) | 简体中文
|
8 |
|
9 | ## 安装
|
10 |
|
11 | 使用下面命令安装:
|
12 |
|
13 | ```
|
14 | npm install -g @4everlink/cli
|
15 | ```
|
16 |
|
17 | ## 命令
|
18 |
|
19 | ```
|
20 | Usage: 4everlink [options] [command]
|
21 |
|
22 | Options:
|
23 | -V, --version output the version number
|
24 | -h, --help output usage information
|
25 |
|
26 | Commands:
|
27 | config <arg> [value] set or show config for host
|
28 | add [options] <file> upload file
|
29 | ```
|
30 | ### **`add`**
|
31 | ```
|
32 | $ 4everlink add --help
|
33 | Usage: 4everlink add [options] <file>
|
34 | Options:
|
35 | -V, --version output the version number
|
36 | -d, --debug output extra debugging
|
37 | -p, --path <path> wrapper dir (default: "/")
|
38 | --host <host> ipfs cluster api host (default: "")
|
39 | --port <port> ipfs cluster api port (default: "")
|
40 | --showAll show all file cid
|
41 | -t, --token <token> ipfs cluster api base auth token (default: "")
|
42 | -r, --recursive recursive all sub dir
|
43 | -a, --all include hidden file
|
44 | -h, --help output usage information
|
45 | ```
|
46 | 返回格式如下:
|
47 | ```
|
48 | {
|
49 | path: 'web',
|
50 | hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
|
51 | size: 1042
|
52 | }
|
53 | ```
|
54 | 或者使用`--showAll`参数
|
55 | ```
|
56 | [
|
57 | {
|
58 | path: 'web/index.html',
|
59 | hash: 'QmZJZG6WuiKMgXw4YANsgJQE98hmahBN7icxPtx4RoDR4M',
|
60 | size: 430
|
61 | },
|
62 | {
|
63 | path: 'web/main.css',
|
64 | hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
|
65 | size: 6
|
66 | },
|
67 | {
|
68 | path: 'web/main.js',
|
69 | hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
|
70 | size: 6
|
71 | },
|
72 | {
|
73 | path: 'web/sub.html',
|
74 | hash: 'QmY3Gn49Dx4ybPwZ8AQ9kFjjWRhr7Y1vVVYp5N9yyYMSg6',
|
75 | size: 393
|
76 | },
|
77 | {
|
78 | path: 'web',
|
79 | hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
|
80 | size: 1042
|
81 | }
|
82 | ]
|
83 | ```
|
84 |
|
85 | `host`, `port`, `token`参数支持通过配置文件配置, 默认配置文件为`~/.4everlink/conf.yaml`,配置文件如下:
|
86 | ```yaml
|
87 | host: "127.0.0.1"
|
88 | port: 9094
|
89 | token: ""
|
90 | ```
|
91 | 配置文件路径可以使用`_4EVERLINKCONF`环境变量自定义设置。例如:
|
92 | `export _4EVERLINKCONF=/custom/path`, 配置文件为: `/custom/path/conf.yaml`。
|
93 |
|
94 | ### **`config`**
|
95 | ```
|
96 | $ 4everlink config --help
|
97 | Usage: 4everlink config [options] <arg> [value]
|
98 |
|
99 | set or show config for host
|
100 |
|
101 | Arguments:
|
102 |
|
103 | arg the params to set, maybe host、port or token
|
104 | value the value to set
|
105 |
|
106 | Options:
|
107 | -h, --help output usage information
|
108 | ```
|
109 | 设置host为`127.0.0.1`: `4everlink config host "127.0.0.1"`;
|
110 | 查看当前host配置: `4everlink config host `
|
111 |
|
112 | ## 许可证
|
113 |
|
114 | [MIT](LICENSE)
|