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 | ##### **`add`**
|
20 | ```
|
21 | $ 4everlink --help
|
22 | Usage: add [options] <file>
|
23 | Options:
|
24 | -V, --version output the version number
|
25 | -d, --debug output extra debugging
|
26 | -p, --path <path> wrapper dir (default: "/")
|
27 | --host <host> ipfs cluster api host (default: "")
|
28 | --port <port> ipfs cluster api port (default: "")
|
29 | --showAll show all file cid
|
30 | -t, --token <token> ipfs cluster api base auth token (default: "")
|
31 | -r, --recursive recursive all sub dir
|
32 | -a, --all include hidden file
|
33 | -h, --help output usage information
|
34 | ```
|
35 | 返回格式如下:
|
36 | ```
|
37 | {
|
38 | path: 'web',
|
39 | hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
|
40 | size: 1042
|
41 | }
|
42 | ```
|
43 | 或者使用showAll参数
|
44 | ```
|
45 | [
|
46 | {
|
47 | path: 'web/index.html',
|
48 | hash: 'QmZJZG6WuiKMgXw4YANsgJQE98hmahBN7icxPtx4RoDR4M',
|
49 | size: 430
|
50 | },
|
51 | {
|
52 | path: 'web/main.css',
|
53 | hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
|
54 | size: 6
|
55 | },
|
56 | {
|
57 | path: 'web/main.js',
|
58 | hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
|
59 | size: 6
|
60 | },
|
61 | {
|
62 | path: 'web/sub.html',
|
63 | hash: 'QmY3Gn49Dx4ybPwZ8AQ9kFjjWRhr7Y1vVVYp5N9yyYMSg6',
|
64 | size: 393
|
65 | },
|
66 | {
|
67 | path: 'web',
|
68 | hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
|
69 | size: 1042
|
70 | }
|
71 | ]
|
72 | ```
|
73 |
|
74 | `host`, `port`, `token`参数支持通过配置文件配置, 默认配置文件为`~/.4everlink/conf.yaml`,配置文件如下:
|
75 | ```yaml
|
76 | host: "127.0.0.1"
|
77 | port: 9094
|
78 | token: ""
|
79 | ```
|
80 | 配置文件路径可以使用`4EVERLINKCONF`环境变量自定义设置。例如:
|
81 | `export 4EVERLINKCONF=/custom/path`, 配置文件为: `/custom/path/conf.yaml`。
|
82 |
|
83 | ## 许可证
|
84 |
|
85 | [MIT](LICENSE)
|