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