溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

IPFS add的使用方法是什么

發(fā)布時(shí)間:2022-01-14 18:02:58 來源:億速云 閱讀:292 作者:iii 欄目:互聯(lián)網(wǎng)科技

本篇內(nèi)容主要講解“IPFS add的使用方法是什么”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“IPFS add的使用方法是什么”吧!

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] [--cid-version=<cid-version>] [--hash=<hash>] [--] <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, size-[bytes] or rabin-[min]-[avg]-[max]. Default: size-262144.
  --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. Implies raw-leaves. (experimental).
  --fscache                          bool   - Check the filestore for pre-existing blocks. (experimental).
  --cid-version                      int    - CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental).
  --hash                             string - Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: sha2-256.

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

  The chunker option, '-s', specifies the chunking strategy that dictates
  how to break files into blocks. Blocks with same content can
  be deduplicated. The default is a fixed block size of
  256 * 1024 bytes, 'size-262144'. Alternatively, you can use the
  rabin chunker for content defined chunking by specifying
  rabin-[min]-[avg]-[max] (where min/avg/max refer to the resulting
  chunk sizes). Using other chunking strategies will produce
  different hashes for the same file.

    > ipfs add --chunker=size-2048 ipfs-logo.svg
    added QmafrLBfzRLV4XSH1XcaMMeaXEUhDJjmtDfsYU95TrWG87 ipfs-logo.svg
    > ipfs add --chunker=rabin-512-1024-2048 ipfs-logo.svg
    added Qmf1hDN65tR55Ubh3RN1FPxr69xq3giVBz1KApsresY8Gn ipfs-logo.svg

  You can now check what blocks have been created by:

    > ipfs object links QmafrLBfzRLV4XSH1XcaMMeaXEUhDJjmtDfsYU95TrWG87
    QmY6yj1GsermExDXoosVE3aSPxdMNYr6aKuw3nA8LoWPRS 2059
    Qmf7ZQeSxq2fJVJbCmgTrLLVN9tDR9Wy5k75DxQKuz5Gyt 1195
    > ipfs object links Qmf1hDN65tR55Ubh3RN1FPxr69xq3giVBz1KApsresY8Gn
    QmY6yj1GsermExDXoosVE3aSPxdMNYr6aKuw3nA8LoWPRS 2059
    QmerURi9k4XzKCaaPbsK6BL5pMEjF7PGphjDvkkjDtsVf3 868
    QmQB28iwSriSUSMqG2nXDTLtdPHgWb4rebBrU7Q1j4vxPv 338

到此,相信大家對“IPFS add的使用方法是什么”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI