IPFS 命令大全

原标题:【IPFS原力区技艺周报】第八期 IPFS客栈管理

Ipfs饭店存款和储蓄ipfs文件数据块,当地数据新闻,秘钥新闻,以致此外计划文件。目录结构如下所示:

IPFS 命令大全

IPFS是三个布满式的大世界文件系统,详细介绍参见:

generated on 2017-04-01 10:53:32.701039,最新变化

  • ipfs
  • ipfs add
  • ipfs bitswap
  • ipfs bitswap
    ledger
  • ipfs bitswap
    stat
  • ipfs bitswap
    unwant
  • ipfs bitswap
    wantlist
  • ipfs block
  • ipfs block get
  • ipfs block put
  • ipfs block rm
  • ipfs block stat
  • ipfs bootstrap
  • ipfs bootstrap
    add
  • ipfs bootstrap add
    default
  • ipfs bootstrap
    list
  • ipfs bootstrap
    rm
  • ipfs bootstrap rm
    all
  • ipfs cat
  • ipfs commands
  • ipfs config
  • ipfs config edit
  • ipfs config
    replace
  • ipfs config show
  • ipfs daemon
  • ipfs dag
  • ipfs dag get
  • ipfs dag put
  • ipfs dht
  • ipfs dht
    findpeer
  • ipfs dht
    findprovs
  • ipfs dht get
  • ipfs dht provide
  • ipfs dht put
  • ipfs dht query
  • ipfs diag
  • ipfs diag cmds
  • ipfs diag cmds
    clear
  • ipfs diag cmds
    set-time
  • ipfs diag sys
  • ipfs dns
  • ipfs file
  • ipfs file ls
  • ipfs files
  • ipfs files cp
  • ipfs files flush
  • ipfs files ls
  • ipfs files mkdir
  • ipfs files mv
  • ipfs files read
  • ipfs files rm
  • ipfs files stat
  • ipfs files write
  • ipfs filestore
  • ipfs filestore
    dups
  • ipfs filestore
    ls
  • ipfs filestore
    verify
  • ipfs get
  • ipfs id
  • ipfs init
  • ipfs key
  • ipfs key gen
  • ipfs key list
  • ipfs log
  • ipfs log level
  • ipfs log ls
  • ipfs log tail
  • ipfs ls
  • ipfs mount
  • ipfs name
  • ipfs name
    publish
  • ipfs name
    resolve
  • ipfs object
  • ipfs object data
  • ipfs object diff
  • ipfs object get
  • ipfs object
    links
  • ipfs object new
  • ipfs object
    patch
  • ipfs object patch
    add-link
  • ipfs object patch
    append-data
  • ipfs object patch
    rm-link
  • ipfs object patch
    set-data
  • ipfs object put
  • ipfs object stat
  • ipfs pin
  • ipfs pin add
  • ipfs pin ls
  • ipfs pin rm
  • ipfs ping
  • ipfs pubsub
  • ipfs pubsub ls
  • ipfs pubsub
    peers
  • ipfs pubsub pub
  • ipfs pubsub sub
  • ipfs refs
  • ipfs refs local
  • ipfs repo
  • ipfs repo fsck
  • ipfs repo gc
  • ipfs repo stat
  • ipfs repo verify
  • ipfs repo
    version
  • ipfs resolve
  • ipfs stats
  • ipfs stats
    bitswap
  • ipfs stats bw
  • ipfs stats repo
  • ipfs swarm
  • ipfs swarm addrs
  • ipfs swarm addrs
    local
  • ipfs swarm
    connect
  • ipfs swarm
    disconnect
  • ipfs swarm
    filters
  • ipfs swarm filters
    add
  • ipfs swarm filters
    rm
  • ipfs swarm peers
  • ipfs tar
  • ipfs tar add
  • ipfs tar cat
  • ipfs tour
  • ipfs tour list
  • ipfs tour next
  • ipfs tour
    restart
  • ipfs update
  • ipfs version

js金沙6629 1

ipfs

USAGE
  ipfs - Global p2p merkle-dag filesystem.

SYNOPSIS
  ipfs [--config=<config> | -c] [--debug=<debug> | -D] [--help=<help>] [-h=<h>] [--local=<local> | -L] [--api=<api>] <command> ...

OPTIONS

  -c,   --config string - Path to the configuration file to use.
  -D,   --debug  bool   - Operate in debug mode. Default: false.
  --help         bool   - Show the full command help text. Default: false.
  -h             bool   - Show a short version of the command help text. Default: false.
  -L,   --local  bool   - Run the command locally, instead of using the daemon. Default: false.
  --api          string - Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001).

SUBCOMMANDS
  BASIC COMMANDS
    init          Initialize ipfs local configuration
    add <path>    Add a file to IPFS
    cat <ref>     Show IPFS object data
    get <ref>     Download IPFS objects
    ls <ref>      List links from an object
    refs <ref>    List hashes of links from an object

  DATA STRUCTURE COMMANDS
    block         Interact with raw blocks in the datastore
    object        Interact with raw dag nodes
    files         Interact with objects as if they were a unix filesystem
    dag           Interact with IPLD documents (experimental)

  ADVANCED COMMANDS
    daemon        Start a long-running daemon process
    mount         Mount an IPFS read-only mountpoint
    resolve       Resolve any type of name
    name          Publish and resolve IPNS names
    key           Create and list IPNS name keypairs
    dns           Resolve DNS links
    pin           Pin objects to local storage
    repo          Manipulate the IPFS repository
    stats         Various operational stats
    filestore     Manage the filestore (experimental)

  NETWORK COMMANDS
    id            Show info about IPFS peers
    bootstrap     Add or remove bootstrap peers
    swarm         Manage connections to the p2p network
    dht           Query the DHT for values or peers
    ping          Measure the latency of a connection
    diag          Print diagnostics

  TOOL COMMANDS
    config        Manage configuration
    version       Show ipfs version information
    update        Download and apply go-ipfs updates
    commands      List all available commands

  Use 'ipfs <command> --help' to learn more about each command.

  ipfs uses a repository in the local file system. By default, the repo is located
  at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable:

    export IPFS_PATH=/path/to/ipfsrepo

  EXIT STATUS

  The CLI will exit with one of the following values:

  0     Successful execution.
  1     Failed executions.

  Use 'ipfs <subcmd> --help' for more information about each command.

1、其汉语件数量块位于blocks文件夹,实践ipfs
init会生成暗中认可文件。PS:比如在本地开启节点之后,访谈:localhost:5001/webui
所展现的辅导页面正是那一个私下认可生成的文本。

ipfs add

USAGE
  ipfs add <path>... - Add a file or directory to ipfs.

SYNOPSIS
  ipfs add [--recursive | -r] [--quiet | -q] [--quieter | -Q] [--silent] [--progress | -p] [--trickle | -t] [--only-hash | -n] [--wrap-with-directory | -w] [--hidden | -H] [--chunker=<chunker> | -s] [--pin=false] [--raw-leaves] [--nocopy] [--fscache] [--] <path>...

ARGUMENTS

  <path>... - The path to a file to be added to ipfs.

OPTIONS

  -r,         --recursive           bool   - Add directory paths recursively. Default: false.
  -q,         --quiet               bool   - Write minimal output.
  -Q,         --quieter             bool   - Write only final hash.
  --silent                          bool   - Write no output.
  -p,         --progress            bool   - Stream progress data.
  -t,         --trickle             bool   - Use trickle-dag format for dag generation.
  -n,         --only-hash           bool   - Only chunk and hash - do not write to disk.
  -w,         --wrap-with-directory bool   - Wrap files with a directory object.
  -H,         --hidden              bool   - Include files that are hidden. Only takes effect on recursive add.
  -s,         --chunker             string - Chunking algorithm to use.
  --pin                             bool   - Pin this object when adding. Default: true.
  --raw-leaves                      bool   - Use raw blocks for leaf nodes. (experimental).
  --nocopy                          bool   - Add the file using filestore. (experimental).
  --fscache                         bool   - Check the filestore for pre-existing blocks. (experimental).

DESCRIPTION

  Adds contents of <path> to ipfs. Use -r to add directories.
  Note that directories are added recursively, to form the ipfs
  MerkleDAG.

  The wrap option, '-w', wraps the file (or files, if using the
  recursive option) in a directory. This directory contains only
  the files which have been added, and means that the file retains
  its filename. For example:

    > ipfs add example.jpg
    added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH example.jpg
    > ipfs add example.jpg -w
    added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH example.jpg
    added QmaG4FuMqEBnQNn3C8XJ5bpW8kLs7zq2ZXgHptJHbKDDVx

  You can now refer to the added file in a gateway, like so:

    /ipfs/QmaG4FuMqEBnQNn3C8XJ5bpW8kLs7zq2ZXgHptJHbKDDVx/example.jpg

js金沙6629 2

ipfs bitswap

USAGE
  ipfs bitswap - Interact with the bitswap agent.

SYNOPSIS
  ipfs bitswap

SUBCOMMANDS
  ipfs bitswap ledger <peer>   - Show the current ledger for a peer.
  ipfs bitswap stat            - Show some diagnostic information on the bitswap agent.
  ipfs bitswap unwant <key>... - Remove a given block from your wantlist.
  ipfs bitswap wantlist        - Show blocks currently on the wantlist.

  Use 'ipfs bitswap <subcmd> --help' for more information about each command.

2、在源代码之中,ipfs.repo全部操作棉被服装进于repo.go文件中,从源代码能够获知,repo操作首要分为以下多少个:stat,gc,fsck,version,verify

ipfs bitswap ledger

USAGE
  ipfs bitswap ledger <peer> - Show the current ledger for a peer.

SYNOPSIS
  ipfs bitswap ledger [--] <peer>

ARGUMENTS

  <peer> - The PeerID (B58) of the ledger to inspect.

DESCRIPTION

  The Bitswap decision engine tracks the number of bytes exchanged between IPFS
  nodes, and stores this information as a collection of ledgers. This command
  prints the ledger associated with a given peer.

js金沙6629 3

ipfs bitswap stat

USAGE
  ipfs bitswap stat - Show some diagnostic information on the bitswap agent.

SYNOPSIS
  ipfs bitswap stat

3、使用ipfs repo stat能够查询本地仓库的音信

ipfs bitswap unwant

USAGE
  ipfs bitswap unwant <key>... - Remove a given block from your wantlist.

SYNOPSIS
  ipfs bitswap unwant [--] <key>...

ARGUMENTS

  <key>... - Key(s) to remove from your wantlist.

js金沙6629 4

ipfs bitswap wantlist

USAGE
  ipfs bitswap wantlist - Show blocks currently on the wantlist.

SYNOPSIS
  ipfs bitswap wantlist [--peer=<peer> | -p]

OPTIONS

  -p, --peer string - Specify which peer to show wantlist for. Default: self.

DESCRIPTION

  Print out all blocks currently on the bitswap wantlist for the local peer.

在那之中各个数据释义如下:
NumObjects:本地旅舍中的对象数。在那处对象数并不等于当麻芋果件的个数,举个例证:当您上传一个文本时(字节数小于切割大小ipfs暗中同意256kb卡塔 尔(英语:State of Qatar),会调换多少个文件夹,包罗上传文件的路线,数据等音讯。这里能够简轻易单驾驭对象数为,blocks文件夹下文件夹的个数。
RepoSize:商旅占用的字节数 Storage马克斯:饭馆最大字节数
RepoPath:当前旅馆的途径Version旅社版本PS:注意上述都是字节大小输出,可选择human参数将文件大小以MB情势出口。
源代码如下:

ipfs block

USAGE
  ipfs block - Interact with raw IPFS blocks.

SYNOPSIS
  ipfs block

DESCRIPTION

  'ipfs block' is a plumbing command used to manipulate raw IPFS blocks.
  Reads from stdin or writes to stdout, and <key> is a base58 encoded
  multihash.

SUBCOMMANDS
  ipfs block get <key>    - Get a raw IPFS block.
  ipfs block put <data>   - Store input as an IPFS block.
  ipfs block rm <hash>... - Remove IPFS block(s).
  ipfs block stat <key>   - Print information of a raw IPFS block.

  Use 'ipfs block <subcmd> --help' for more information about each command.

js金沙6629 5

ipfs block get

USAGE
  ipfs block get <key> - Get a raw IPFS block.

SYNOPSIS
  ipfs block get [--] <key>

ARGUMENTS

  <key> - The base58 multihash of an existing block to get.

DESCRIPTION

  'ipfs block get' is a plumbing command for retrieving raw IPFS blocks.
  It outputs to stdout, and <key> is a base58 encoded multihash.

4、ipfs repo gc 扫描饭馆中的对象,回笼磁盘空间

ipfs block put

USAGE
  ipfs block put <data> - Store input as an IPFS block.

SYNOPSIS
  ipfs block put [--format=<format> | -f] [--mhtype=<mhtype>] [--mhlen=<mhlen>] [--] <data>

ARGUMENTS

  <data> - The data to be stored as an IPFS block.

OPTIONS

  -f,     --format string - cid format for blocks to be created with. Default: v0.
  --mhtype         string - multihash hash function. Default: sha2-256.
  --mhlen          int    - multihash hash length. Default: -1.

DESCRIPTION

  'ipfs block put' is a plumbing command for storing raw IPFS blocks.
  It reads from stdin, and <key> is a base58 encoded multihash.

js金沙6629 6

ipfs block rm

USAGE
  ipfs block rm <hash>... - Remove IPFS block(s).

SYNOPSIS
  ipfs block rm [--force | -f] [--quiet | -q] [--] <hash>...

ARGUMENTS

  <hash>... - Bash58 encoded multihash of block(s) to remove.

OPTIONS

  -f, --force bool - Ignore nonexistent blocks. Default: false.
  -q, --quiet bool - Write minimal output. Default: false.

DESCRIPTION

  'ipfs block rm' is a plumbing command for removing raw ipfs blocks.
  It takes a list of base58 encoded multihashs to remove.

删去未有定点的靶子。即unpin对象
比方:为刚上传的一个文件消逝pin(上传文件默感到pin卡塔 尔(阿拉伯语:قطر‎那时候再运转gc指令,将去除该文件及其配置音信。

ipfs block stat

USAGE
  ipfs block stat <key> - Print information of a raw IPFS block.

SYNOPSIS
  ipfs block stat [--] <key>

ARGUMENTS

  <key> - The base58 multihash of an existing block to stat.

DESCRIPTION

  'ipfs block stat' is a plumbing command for retrieving information
  on raw IPFS blocks. It outputs the following to stdout:

    Key  - the base58 encoded multihash
    Size - the size of the block in bytes

js金沙6629 7

ipfs bootstrap

USAGE
  ipfs bootstrap - Show or edit the list of bootstrap peers.

SYNOPSIS
  ipfs bootstrap

DESCRIPTION

  Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'.

  SECURITY WARNING:

  The bootstrap command manipulates the "bootstrap list", which contains
  the addresses of bootstrap nodes. These are the *trusted peers* from
  which to learn about other peers in the network. Only edit this list
  if you understand the risks of adding or removing nodes from this list.

SUBCOMMANDS
  ipfs bootstrap add [<peer>]... - Add peers to the bootstrap list.
  ipfs bootstrap list            - Show peers in the bootstrap list.
  ipfs bootstrap rm [<peer>]...  - Remove peers from the bootstrap list.

  Use 'ipfs bootstrap <subcmd> --help' for more information about each command.

5、Ipfs repo fsck删除货仓中的锁文件

ipfs bootstrap add

USAGE
  ipfs bootstrap add [<peer>]... - Add peers to the bootstrap list.

SYNOPSIS
  ipfs bootstrap add [--default] [--] [<peer>...]

ARGUMENTS

  [<peer>]... - A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')

OPTIONS

  --default bool - Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead).

DESCRIPTION

  Outputs a list of peers that were added (that weren't already
  in the bootstrap list).

  SECURITY WARNING:

  The bootstrap command manipulates the "bootstrap list", which contains
  the addresses of bootstrap nodes. These are the *trusted peers* from
  which to learn about other peers in the network. Only edit this list
  if you understand the risks of adding or removing nodes from this list.

SUBCOMMANDS
  ipfs bootstrap add default - Add default peers to the bootstrap list.

  Use 'ipfs bootstrap add <subcmd> --help' for more information about each command.

js金沙6629 8

ipfs bootstrap add default

USAGE
  ipfs bootstrap add default - Add default peers to the bootstrap list.

SYNOPSIS
  ipfs bootstrap add default

DESCRIPTION

  Outputs a list of peers that were added (that weren't already
  in the bootstrap list).

PS:如果本地daemon节点开启时运营此命令将应际而生如下错误:

ipfs bootstrap list

USAGE
  ipfs bootstrap list - Show peers in the bootstrap list.

SYNOPSIS
  ipfs bootstrap list

DESCRIPTION

  Peers are output in the format '<multiaddr>/<peerID>'.

js金沙6629 9

ipfs bootstrap rm

USAGE
  ipfs bootstrap rm [<peer>]... - Remove peers from the bootstrap list.

SYNOPSIS
  ipfs bootstrap rm [--all] [--] [<peer>...]

ARGUMENTS

  [<peer>]... - A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')

OPTIONS

  --all bool - Remove all bootstrap peers. (Deprecated, use 'all' subcommand).

DESCRIPTION

  Outputs the list of peers that were removed.

  SECURITY WARNING:

  The bootstrap command manipulates the "bootstrap list", which contains
  the addresses of bootstrap nodes. These are the *trusted peers* from
  which to learn about other peers in the network. Only edit this list
  if you understand the risks of adding or removing nodes from this list.

SUBCOMMANDS
  ipfs bootstrap rm all - Remove all peers from the bootstrap list.

  Use 'ipfs bootstrap rm <subcmd> --help' for more information about each command.

因此运营指令时供给关闭本地daemon

ipfs bootstrap rm all

USAGE
  ipfs bootstrap rm all - Remove all peers from the bootstrap list.

SYNOPSIS
  ipfs bootstrap rm all

DESCRIPTION

  Outputs the list of peers that were removed.

6、ipfs repo version打字与印刷当前饭店的版本消息

ipfs cat

USAGE
  ipfs cat <ipfs-path>... - Show IPFS object data.

SYNOPSIS
  ipfs cat [--] <ipfs-path>...

ARGUMENTS

  <ipfs-path>... - The path to the IPFS object(s) to be outputted.

DESCRIPTION

  Displays the data contained by an IPFS or IPNS object(s) at the given path.

js金沙6629 10

ipfs commands

USAGE
  ipfs commands - List all available commands.

SYNOPSIS
  ipfs commands [--flags | -f]

OPTIONS

  -f, --flags bool - Show command flags. Default: false.

DESCRIPTION

  Lists all available commands (and subcommands) and exits.

7、ipfs repo verify命令对库房的完好性举行校验

ipfs config

USAGE
  ipfs config <key> [<value>] - Get and set ipfs config values.

SYNOPSIS
  ipfs config [--bool] [--json] [--] <key> [<value>]

ARGUMENTS

  <key>     - The key of the config entry (e.g. "Addresses.API").
  [<value>] - The value to set the config entry to.

OPTIONS

  --bool bool - Set a boolean value. Default: false.
  --json bool - Parse stringified JSON. Default: false.

DESCRIPTION

  'ipfs config' controls configuration variables. It works
  much like 'git config'. The configuration values are stored in a config
  file inside your IPFS repository.

  Examples:

  Get the value of the 'Datastore.Path' key:

    $ ipfs config Datastore.Path

  Set the value of the 'Datastore.Path' key:

    $ ipfs config Datastore.Path ~/.ipfs/datastore

SUBCOMMANDS
  ipfs config edit           - Open the config file for editing in $EDITOR.
  ipfs config replace <file> - Replace the config with <file>.
  ipfs config show           - Output config file contents.

  Use 'ipfs config <subcmd> --help' for more information about each command.

js金沙6629 11

ipfs config edit

USAGE
  ipfs config edit - Open the config file for editing in $EDITOR.

SYNOPSIS
  ipfs config edit

DESCRIPTION

  To use 'ipfs config edit', you must have the $EDITOR environment
  variable set to your preferred text editor.

​IPFS原力区是全球第一大IPFS价值生态社区,总局放在北京,聚焦了累累本事大牛和IPFS爱好者;IPFS原力区秉持:价值,一起创建,双赢,荣耀的学识观念;提供周全、精细、优秀的IPFS咨询和技能帮助,将生态中的爱好者转变为IPFS协助者和参加者。
今后,IPFS原力区做好价值文化基因传播、紧盯人工智能,量子总计,大额等战线科学和技术,把IPFS区块链手艺随即架设在风靡的技能根底之上,推动IPFS生态的符合规律化向上。回到腾讯网,查看越来越多

ipfs config replace

USAGE
  ipfs config replace <file> - Replace the config with <file>.

SYNOPSIS
  ipfs config replace [--] <file>

ARGUMENTS

  <file> - The file to use as the new config.

DESCRIPTION

  Make sure to back up the config file first if neccessary, as this operation
  can't be undone.

主编:

ipfs config show

USAGE
  ipfs config show - Output config file contents.

SYNOPSIS
  ipfs config show

DESCRIPTION

  WARNING: Your private key is stored in the config file, and it will be
  included in the output of this command.

ipfs daemon

USAGE
  ipfs daemon - Run a network-connected IPFS node.

SYNOPSIS
  ipfs daemon [--init] [--routing=<routing>] [--mount] [--writable] [--mount-ipfs=<mount-ipfs>] [--mount-ipns=<mount-ipns>] [--unrestricted-api] [--disable-transport-encryption] [--enable-gc] [--manage-fdlimit=false] [--offline] [--migrate] [--enable-pubsub-experiment] [--enable-mplex-experiment=false]

OPTIONS

  --init                         bool   - Initialize ipfs with default settings if not already initialized. Default: false.
  --routing                      string - Overrides the routing option. Default: dht.
  --mount                        bool   - Mounts IPFS to the filesystem. Default: false.
  --writable                     bool   - Enable writing objects (with POST, PUT and DELETE). Default: false.
  --mount-ipfs                   string - Path to the mountpoint for IPFS (if using --mount). Defaults to config setting.
  --mount-ipns                   string - Path to the mountpoint for IPNS (if using --mount). Defaults to config setting.
  --unrestricted-api             bool   - Allow API access to unlisted hashes. Default: false.
  --disable-transport-encryption bool   - Disable transport encryption (for debugging protocols). Default: false.
  --enable-gc                    bool   - Enable automatic periodic repo garbage collection. Default: false.
  --manage-fdlimit               bool   - Check and raise file descriptor limits if needed. Default: true.
  --offline                      bool   - Run offline. Do not connect to the rest of the network but provide local API. Default: false.
  --migrate                      bool   - If true, assume yes at the migrate prompt. If false, assume no.
  --enable-pubsub-experiment     bool   - Instantiate the ipfs daemon with the experimental pubsub feature enabled.
  --enable-mplex-experiment      bool   - Add the experimental 'go-multiplex' stream muxer to libp2p on construction. Default: true.

DESCRIPTION

  The daemon will start listening on ports on the network, which are
  documented in (and can be modified through) 'ipfs config Addresses'.
  For example, to change the 'Gateway' port:

      ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8082

  The API address can be changed the same way:

     ipfs config Addresses.API /ip4/127.0.0.1/tcp/5002

  Make sure to restart the daemon after changing addresses.

  By default, the gateway is only accessible locally. To expose it to
  other computers in the network, use 0.0.0.0 as the ip address:

     ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080

  Be careful if you expose the API. It is a security risk, as anyone could
  control your node remotely. If you need to control the node remotely,
  make sure to protect the port as you would other services or database
  (firewall, authenticated proxy, etc).

  HTTP Headers

  ipfs supports passing arbitrary headers to the API and Gateway. You can
  do this by setting headers on the API.HTTPHeaders and Gateway.HTTPHeaders
  keys:

    ipfs config --json API.HTTPHeaders.X-Special-Header '["so special :)"]'
    ipfs config --json Gateway.HTTPHeaders.X-Special-Header '["so special :)"]'

  Note that the value of the keys is an _array_ of strings. This is because
  headers can have more than one value, and it is convenient to pass through
  to other libraries.

  CORS Headers (for API)

  You can setup CORS headers the same way:

    ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["example.com"]'
    ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
    ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

  Shutdown

  To shutdown the daemon, send a SIGINT signal to it (e.g. by pressing 'Ctrl-C')
  or send a SIGTERM signal to it (e.g. with 'kill'). It may take a while for the
  daemon to shutdown gracefully, but it can be killed forcibly by sending a
  second signal.

  IPFS_PATH environment variable

  ipfs uses a repository in the local file system. By default, the repo is
  located at ~/.ipfs. To change the repo location, set the $IPFS_PATH
  environment variable:

      export IPFS_PATH=/path/to/ipfsrepo

  Routing

  IPFS by default will use a DHT for content routing. There is a highly
  experimental alternative that operates the DHT in a 'client only' mode that can
  be enabled by running the daemon as:

      ipfs daemon --routing=dhtclient

  This will later be transitioned into a config option once it gets out of the
  'experimental' stage.

  DEPRECATION NOTICE

  Previously, ipfs used an environment variable as seen below:

     export API_ORIGIN="http://localhost:8888/"

  This is deprecated. It is still honored in this version, but will be removed
  in a future version, along with this notice. Please move to setting the HTTP
  Headers.

ipfs dag

USAGE
  ipfs dag - Interact with ipld dag objects.

SYNOPSIS
  ipfs dag

DESCRIPTION

  'ipfs dag' is used for creating and manipulating dag objects.

  This subcommand is currently an experimental feature, but it is intended
  to deprecate and replace the existing 'ipfs object' command moving forward.


SUBCOMMANDS
  ipfs dag get <ref>         - Get a dag node from ipfs.
  ipfs dag put <object data> - Add a dag node to ipfs.

  Use 'ipfs dag <subcmd> --help' for more information about each command.

js金沙6629,ipfs dag get

USAGE
  ipfs dag get <ref> - Get a dag node from ipfs.

SYNOPSIS
  ipfs dag get [--] <ref>

ARGUMENTS

  <ref> - The object to get

DESCRIPTION

  'ipfs dag get' fetches a dag node from ipfs and prints it out in the specifed format.

ipfs dag put

USAGE
  ipfs dag put <object data> - Add a dag node to ipfs.

SYNOPSIS
  ipfs dag put [--format=<format> | -f] [--input-enc=<input-enc>] [--] <object data>

ARGUMENTS

  <object data> - The object to put

OPTIONS

  -f,        --format string - Format that the object will be added as. Default: cbor.
  --input-enc         string - Format that the input object will be. Default: json.

DESCRIPTION

  'ipfs dag put' accepts input from a file or stdin and parses it
  into an object of the specified format.

ipfs dht

USAGE
  ipfs dht - Issue commands directly through the DHT.

SYNOPSIS
  ipfs dht

SUBCOMMANDS
  ipfs dht findpeer <peerID>... - Query the DHT for all of the multiaddresses associated with a Peer ID.
  ipfs dht findprovs <key>...   - Find peers in the DHT that can provide a specific value, given a key.
  ipfs dht get <key>...         - Given a key, query the DHT for its best value.
  ipfs dht provide <key>...     - Announce to the network that you are providing given values.
  ipfs dht put <key> <value>    - Write a key/value pair to the DHT.
  ipfs dht query <peerID>...    - Find the closest Peer IDs to a given Peer ID by querying the DHT.

  Use 'ipfs dht <subcmd> --help' for more information about each command.

ipfs dht findpeer

USAGE
  ipfs dht findpeer <peerID>... - Query the DHT for all of the multiaddresses associated with a Peer ID.

SYNOPSIS
  ipfs dht findpeer [--verbose | -v] [--] <peerID>...

ARGUMENTS

  <peerID>... - The ID of the peer to search for.

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Outputs a list of newline-delimited multiaddresses.

ipfs dht findprovs

USAGE
  ipfs dht findprovs <key>... - Find peers in the DHT that can provide a specific value, given a key.

SYNOPSIS
  ipfs dht findprovs [--verbose | -v] [--] <key>...

ARGUMENTS

  <key>... - The key to find providers for.

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Outputs a list of newline-delimited provider Peer IDs.

ipfs dht get

USAGE
  ipfs dht get <key>... - Given a key, query the DHT for its best value.

SYNOPSIS
  ipfs dht get [--verbose | -v] [--] <key>...

ARGUMENTS

  <key>... - The key to find a value for.

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Outputs the best value for the given key.

  There may be several different values for a given key stored in the DHT; in
  this context 'best' means the record that is most desirable. There is no one
  metric for 'best': it depends entirely on the key type. For IPNS, 'best' is
  the record that is both valid and has the highest sequence number (freshest).
  Different key types can specify other 'best' rules.

ipfs dht provide

USAGE
  ipfs dht provide <key>... - Announce to the network that you are providing given values.

SYNOPSIS
  ipfs dht provide [--verbose | -v] [--recursive | -r] [--] <key>...

ARGUMENTS

  <key>... - The key[s] to send provide records for.

OPTIONS

  -v, --verbose   bool - Print extra information. Default: false.
  -r, --recursive bool - Recursively provide entire graph. Default: false.

ipfs dht put

USAGE
  ipfs dht put <key> <value> - Write a key/value pair to the DHT.

SYNOPSIS
  ipfs dht put [--verbose | -v] [--] <key> <value>

ARGUMENTS

  <key>   - The key to store the value at.
  <value> - The value to store.

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Given a key of the form /foo/bar and a value of any form, this will write that
  value to the DHT with that key.

  Keys have two parts: a keytype (foo) and the key name (bar). IPNS uses the
  /ipns keytype, and expects the key name to be a Peer ID. IPNS entries are
  specifically formatted (protocol buffer).

  You may only use keytypes that are supported in your ipfs binary: currently
  this is only /ipns. Unless you have a relatively deep understanding of the
  go-ipfs DHT internals, you likely want to be using 'ipfs name publish' instead
  of this.

  Value is arbitrary text. Standard input can be used to provide value.

  NOTE: A value may not exceed 2048 bytes.

ipfs dht query

USAGE
  ipfs dht query <peerID>... - Find the closest Peer IDs to a given Peer ID by querying the DHT.

SYNOPSIS
  ipfs dht query [--verbose | -v] [--] <peerID>...

ARGUMENTS

  <peerID>... - The peerID to run the query against.

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Outputs a list of newline-delimited Peer IDs.

ipfs diag

USAGE
  ipfs diag - Generate diagnostic reports.

SYNOPSIS
  ipfs diag

SUBCOMMANDS
  ipfs diag cmds - List commands run on this IPFS node.
  ipfs diag net  - Generate a network diagnostics report.
  ipfs diag sys  - Print system diagnostic information.

  Use 'ipfs diag <subcmd> --help' for more information about each command.

ipfs diag cmds

USAGE
  ipfs diag cmds - List commands run on this IPFS node.

SYNOPSIS
  ipfs diag cmds [--verbose | -v]

OPTIONS

  -v, --verbose bool - Print extra information. Default: false.

DESCRIPTION

  Lists running and recently run commands.

SUBCOMMANDS
  ipfs diag cmds clear           - Clear inactive requests from the log.
  ipfs diag cmds set-time <time> - Set how long to keep inactive requests in the log.

  Use 'ipfs diag cmds <subcmd> --help' for more information about each command.

ipfs diag cmds clear

USAGE
  ipfs diag cmds clear - Clear inactive requests from the log.

SYNOPSIS
  ipfs diag cmds clear

ipfs diag cmds set-time

USAGE
  ipfs diag cmds set-time <time> - Set how long to keep inactive requests in the log.

SYNOPSIS
  ipfs diag cmds set-time [--] <time>

ARGUMENTS

  <time> - Time to keep inactive requests in log.

ipfs diag sys

USAGE
  ipfs diag sys - Print system diagnostic information.

SYNOPSIS
  ipfs diag sys

DESCRIPTION

  Prints out information about your computer to aid in easier debugging.

ipfs dns

USAGE
  ipfs dns <domain-name> - Resolve DNS links.

SYNOPSIS
  ipfs dns [--recursive | -r] [--] <domain-name>

ARGUMENTS

  <domain-name> - The domain-name name to resolve.

OPTIONS

  -r, --recursive bool - Resolve until the result is not a DNS link. Default: false.

DESCRIPTION

  Multihashes are hard to remember, but domain names are usually easy to
  remember.  To create memorable aliases for multihashes, DNS TXT
  records can point to other DNS links, IPFS objects, IPNS keys, etc.
  This command resolves those links to the referenced object.

  For example, with this DNS TXT record:

    > dig +short TXT _dnslink.ipfs.io
    dnslink=/ipfs/QmRzTuh2Lpuz7Gr39stNr6mTFdqAghsZec1JoUnfySUzcy

  The resolver will give:

    > ipfs dns ipfs.io
    /ipfs/QmRzTuh2Lpuz7Gr39stNr6mTFdqAghsZec1JoUnfySUzcy

  The resolver can recursively resolve:

    > dig +short TXT recursive.ipfs.io
    dnslink=/ipns/ipfs.io
    > ipfs dns -r recursive.ipfs.io
    /ipfs/QmRzTuh2Lpuz7Gr39stNr6mTFdqAghsZec1JoUnfySUzcy

ipfs file

USAGE
  ipfs file - Interact with IPFS objects representing Unix filesystems.

SYNOPSIS
  ipfs file

DESCRIPTION

  'ipfs file' provides a familiar interface to file systems represented
  by IPFS objects, which hides ipfs implementation details like layout
  objects (e.g. fanout and chunking).

SUBCOMMANDS
  ipfs file ls <ipfs-path>... - List directory contents for Unix filesystem objects.

  Use 'ipfs file <subcmd> --help' for more information about each command.

ipfs file ls

USAGE
  ipfs file ls <ipfs-path>... - List directory contents for Unix filesystem objects.

SYNOPSIS
  ipfs file ls [--] <ipfs-path>...

ARGUMENTS

  <ipfs-path>... - The path to the IPFS object(s) to list links from.

DESCRIPTION

  Displays the contents of an IPFS or IPNS object(s) at the given path.

  The JSON output contains size information. For files, the child size
  is the total size of the file contents. For directories, the child
  size is the IPFS link size.

  The path can be a prefixless ref; in this case, we assume it to be an
  /ipfs ref and not /ipns.

  Example:

      > ipfs file ls QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ
      cat.jpg
      > ipfs file ls /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ
      cat.jpg

  This functionality is deprecated, and will be removed in future versions. If
  possible, please use 'ipfs ls' instead.

ipfs files

USAGE
  ipfs files - Interact with unixfs files.

SYNOPSIS
  ipfs files [--f=false]

OPTIONS

  -f, --flush bool - Flush target and ancestors after write. Default: true.

DESCRIPTION

  Files is an API for manipulating IPFS objects as if they were a unix
  filesystem.

  NOTE:
  Most of the subcommands of 'ipfs files' accept the '--flush' flag. It defaults
  to true. Use caution when setting this flag to false. It will improve
  performance for large numbers of file operations, but it does so at the cost
  of consistency guarantees. If the daemon is unexpectedly killed before running
  'ipfs files flush' on the files in question, then data may be lost. This also
  applies to running 'ipfs repo gc' concurrently with '--flush=false'
  operations.

SUBCOMMANDS
  ipfs files cp <source> <dest>  - Copy files into mfs.
  ipfs files flush [<path>]      - Flush a given path's data to disk.
  ipfs files ls [<path>]         - List directories in the local mutable namespace.
  ipfs files mkdir <path>        - Make directories.
  ipfs files mv <source> <dest>  - Move files.
  ipfs files read <path>         - Read a file in a given mfs.
  ipfs files rm <path>...        - Remove a file.
  ipfs files stat <path>         - Display file status.
  ipfs files write <path> <data> - Write to a mutable file in a given filesystem.

  Use 'ipfs files <subcmd> --help' for more information about each command.

ipfs files cp

USAGE
  ipfs files cp <source> <dest> - Copy files into mfs.

SYNOPSIS
  ipfs files cp [--] <source> <dest>

ARGUMENTS

  <source> - Source object to copy.
  <dest>   - Destination to copy object to.

ipfs files flush

USAGE
  ipfs files flush [<path>] - Flush a given path's data to disk.

SYNOPSIS
  ipfs files flush [--] [<path>]

ARGUMENTS

  [<path>] - Path to flush. Default: '/'.

DESCRIPTION

  Flush a given path to disk. This is only useful when other commands
  are run with the '--flush=false'.

ipfs files ls

USAGE
  ipfs files ls [<path>] - List directories in the local mutable namespace.

SYNOPSIS
  ipfs files ls [-l] [--] [<path>]

ARGUMENTS

  [<path>] - Path to show listing for. Defaults to '/'.

OPTIONS

  -l bool - Use long listing format.

DESCRIPTION

  List directories in the local mutable namespace.

  Examples:

      $ ipfs files ls /welcome/docs/
      about
      contact
      help
      quick-start
      readme
      security-notes

      $ ipfs files ls /myfiles/a/b/c/d
      foo
      bar

ipfs files mkdir

USAGE
  ipfs files mkdir <path> - Make directories.

SYNOPSIS
  ipfs files mkdir [--parents | -p] [--] <path>

ARGUMENTS

  <path> - Path to dir to make.

OPTIONS

  -p, --parents bool - No error if existing, make parent directories as needed.

DESCRIPTION

  Create the directory if it does not already exist.

  NOTE: All paths must be absolute.

  Examples:

      $ ipfs mfs mkdir /test/newdir
      $ ipfs mfs mkdir -p /test/does/not/exist/yet

ipfs files mv

USAGE
  ipfs files mv <source> <dest> - Move files.

SYNOPSIS
  ipfs files mv [--] <source> <dest>

ARGUMENTS

  <source> - Source file to move.
  <dest>   - Destination path for file to be moved to.

DESCRIPTION

  Move files around. Just like traditional unix mv.

  Example:

      $ ipfs files mv /myfs/a/b/c /myfs/foo/newc

ipfs files read

USAGE
  ipfs files read <path> - Read a file in a given mfs.

SYNOPSIS
  ipfs files read [--offset=<offset> | -o] [--count=<count> | -n] [--] <path>

ARGUMENTS

  <path> - Path to file to be read.

OPTIONS

  -o, --offset int - Byte offset to begin reading from.
  -n, --count  int - Maximum number of bytes to read.

DESCRIPTION

  Read a specified number of bytes from a file at a given offset. By default,
  will read the entire file similar to unix cat.

  Examples:

      $ ipfs files read /test/hello
      hello

ipfs files rm

USAGE
  ipfs files rm <path>... - Remove a file.

SYNOPSIS
  ipfs files rm [--recursive | -r] [--] <path>...

ARGUMENTS

  <path>... - File to remove.

OPTIONS

  -r, --recursive bool - Recursively remove directories.

DESCRIPTION

  Remove files or directories.

      $ ipfs files rm /foo
      $ ipfs files ls /bar
      cat
      dog
      fish
      $ ipfs files rm -r /bar

ipfs files stat

USAGE
  ipfs files stat <path> - Display file status.

SYNOPSIS
  ipfs files stat [--format=<format>] [--hash] [--size] [--] <path>

ARGUMENTS

  <path> - Path to node to stat.

OPTIONS

  --format string - Print statistics in given format. Allowed tokens: <hash> <size> <cumulsize> <type> <childs>. Conflicts with other format options. Default: <hash>
  Size: <size>
  CumulativeSize: <cumulsize>
  ChildBlocks: <childs>
  Type: <type>.
  --hash   bool   - Print only hash. Implies '--format=<hash>'. Conflicts with other format options. Default: false.
  --size   bool   - Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options. Default: false.

ipfs files write

USAGE
  ipfs files write <path> <data> - Write to a mutable file in a given filesystem.

SYNOPSIS
  ipfs files write [--offset=<offset> | -o] [--create | -e] [--truncate | -t] [--count=<count> | -n] [--] <path> <data>

ARGUMENTS

  <path> - Path to write to.
  <data> - Data to write.

OPTIONS

  -o, --offset   int  - Byte offset to begin writing at.
  -e, --create   bool - Create the file if it does not exist.
  -t, --truncate bool - Truncate the file to size zero before writing.
  -n, --count    int  - Maximum number of bytes to read.

DESCRIPTION

  Write data to a file in a given filesystem. This command allows you to specify
  a beginning offset to write to. The entire length of the input will be written.

  If the '--create' option is specified, the file will be created if it does not
  exist. Nonexistant intermediate directories will not be created.

  If the '--flush' option is set to false, changes will not be propogated to the
  merkledag root. This can make operations much faster when doing a large number
  of writes to a deeper directory structure.

  EXAMPLE:

      echo "hello world" | ipfs files write --create /myfs/a/b/file
      echo "hello world" | ipfs files write --truncate /myfs/a/b/file

  WARNING:

  Usage of the '--flush=false' option does not guarantee data durability until
  the tree has been flushed. This can be accomplished by running 'ipfs files
  stat' on the file or any of its ancestors.

ipfs filestore

USAGE
  ipfs filestore - Interact with filestore objects.

SYNOPSIS
  ipfs filestore

SUBCOMMANDS
  ipfs filestore dups              - List blocks that are both in the filestore and standard block storage.
  ipfs filestore ls [<obj>]...     - List objects in filestore.
  ipfs filestore verify [<obj>]... - Verify objects in filestore.

  Use 'ipfs filestore <subcmd> --help' for more information about each command.

ipfs filestore dups

USAGE
  ipfs filestore dups - List blocks that are both in the filestore and standard block storage.

SYNOPSIS
  ipfs filestore dups

ipfs filestore ls

USAGE
  ipfs filestore ls [<obj>]... - List objects in filestore.

SYNOPSIS
  ipfs filestore ls [--] [<obj>...]

ARGUMENTS

  [<obj>]... - Cid of objects to list.

DESCRIPTION

  List objects in the filestore.

  If one or more <obj> is specified only list those specific objects,
  otherwise list all objects.

  The output is:

  <hash> <size> <path> <offset>

ipfs filestore verify

USAGE
  ipfs filestore verify [<obj>]... - Verify objects in filestore.

SYNOPSIS
  ipfs filestore verify [--] [<obj>...]

ARGUMENTS

  [<obj>]... - Cid of objects to verify.

DESCRIPTION

  Verify objects in the filestore.

  If one or more <obj> is specified only verify those specific objects,
  otherwise verify all objects.

  The output is:

  <status> <hash> <size> <path> <offset>

  Where <status> is one of:
  ok:       the block can be reconstructed
  changed:  the contents of the backing file have changed
  no-file:  the backing file could not be found
  error:    there was some other problem reading the file
  missing:  <obj> could not be found in the filestore
  ERROR:    internal error, most likely due to a corrupt database

  For ERROR entries the error will also be printed to stderr.

ipfs get

USAGE
  ipfs get <ipfs-path> - Download IPFS objects.

SYNOPSIS
  ipfs get [--output=<output> | -o] [--archive | -a] [--compress | -C] [--compression-level=<compression-level> | -l] [--] <ipfs-path>

ARGUMENTS

  <ipfs-path> - The path to the IPFS object(s) to be outputted.

OPTIONS

  -o, --output            string - The path where the output should be stored.
  -a, --archive           bool   - Output a TAR archive. Default: false.
  -C, --compress          bool   - Compress the output with GZIP compression. Default: false.
  -l, --compression-level int    - The level of compression (1-9). Default: -1.

DESCRIPTION

  Stores to disk the data contained an IPFS or IPNS object(s) at the given path.

  By default, the output will be stored at './<ipfs-path>', but an alternate
  path can be specified with '--output=<path>' or '-o=<path>'.

  To output a TAR archive instead of unpacked files, use '--archive' or '-a'.

  To compress the output with GZIP compression, use '--compress' or '-C'. You
  may also specify the level of compression by specifying '-l=<1-9>'.

ipfs id

USAGE
  ipfs id [<peerid>] - Show ipfs node id info.

SYNOPSIS
  ipfs id [--format=<format> | -f] [--] [<peerid>]

ARGUMENTS

  [<peerid>] - Peer.ID of node to look up.

OPTIONS

  -f, --format string - Optional output format.

DESCRIPTION

  Prints out information about the specified peer.
  If no peer is specified, prints out information for local peers.

  'ipfs id' supports the format option for output with the following keys:
  <id> : The peers id.
  <aver>: Agent version.
  <pver>: Protocol version.
  <pubkey>: Public key.
  <addrs>: Addresses (newline delimited).

  EXAMPLE:

      ipfs id Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH -f="<addrs>\n"

ipfs init

USAGE
  ipfs init [<default-config>] - Initializes ipfs config file.

SYNOPSIS
  ipfs init [--bits=<bits> | -b] [--empty-repo | -e] [--] [<default-config>]

ARGUMENTS

  [<default-config>] - Initialize with the given configuration.

OPTIONS

  -b, --bits       int  - Number of bits to use in the generated RSA private key. Default: 2048.
  -e, --empty-repo bool - Don't add and pin help files to the local storage. Default: false.

DESCRIPTION

  Initializes ipfs configuration files and generates a new keypair.

  ipfs uses a repository in the local file system. By default, the repo is
  located at ~/.ipfs. To change the repo location, set the $IPFS_PATH
  environment variable:

      export IPFS_PATH=/path/to/ipfsrepo

ipfs key

USAGE
  ipfs key - Create and list IPNS name keypairs

SYNOPSIS
  ipfs key

DESCRIPTION

  'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name publish'.

    > ipfs key gen --type=rsa --size=2048 mykey
    > ipfs name publish --key=mykey QmSomeHash

  'ipfs key list' lists the available keys.

    > ipfs key list
    self
    mykey


SUBCOMMANDS
  ipfs key gen <name> - Create a new keypair
  ipfs key list       - List all local keypairs

  Use 'ipfs key <subcmd> --help' for more information about each command.

ipfs key gen

USAGE
  ipfs key gen <name> - Create a new keypair

SYNOPSIS
  ipfs key gen [--type=<type> | -t] [--size=<size> | -s] [--] <name>

ARGUMENTS

  <name> - name of key to create

OPTIONS

  -t, --type string - type of the key to create [rsa, ed25519].
  -s, --size int    - size of the key to generate.

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*
*
Website