ipfs-cluster-uploader

command line tool for upload file or directory use the IPFS Cluster HTTP API.

Usage no npm install needed!

<script type="module">
  import ipfsClusterUploader from 'https://cdn.skypack.dev/ipfs-cluster-uploader';
</script>

README

A command line tool for upload file to IPFS Cluster use the IPFS Cluster HTTP API.

NPM Version Install Size License

Read this in other languages: English | 简体中文

install

npm install -g ipfs-cluster-uploader

Command

add
$ ipfs-cluster-upload --help
Usage: add [options] <file>
Options:
  -V, --version        output the version number
  -d, --debug          output extra debugging
  -p, --path <path>    wrapper dir (default: "/")
  -h, --host <host>    ipfs cluster api host (default: "")
  --port <port>        ipfs cluster api port (default: "")
  --showAll            show all file cid
  -t, --token <token>  ipfs cluster api base auth token (default: "")
  -r, --recursive      recursive all sub dir
  -a, --all            include hidden file
  --help               output usage information

output data:

{
  path: 'web',
  hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
  size: 1042
}

or use showAll

[
  {
    path: 'web/index.html',
    hash: 'QmZJZG6WuiKMgXw4YANsgJQE98hmahBN7icxPtx4RoDR4M',
    size: 430
  },
  {
    path: 'web/main.css',
    hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
    size: 6
  },
  {
    path: 'web/main.js',
    hash: 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH',
    size: 6
  },
  {
    path: 'web/sub.html',
    hash: 'QmY3Gn49Dx4ybPwZ8AQ9kFjjWRhr7Y1vVVYp5N9yyYMSg6',
    size: 393
  },
  {
    path: 'web',
    hash: 'QmdiRp2QU1pYb4r1Hmbfah3Ckqq2p56vDSBarm4VWHSdWg',
    size: 1042
  }
]

host, port, token support load from config file, default config file is ~/.ipfs_cluster_client.yaml, for example:

host: "127.0.0.1"
port: 9094
token: ""

use env IPFS_CLUSTER_CLIENT_CONF set custom config file path.

License

MIT