ipfs/kubo

Ability to specify known hash when adding

開放

#1,957 建立於 2015年11月10日

 (1 則留言) (0 個反應) (0 位負責人)Go (2,725 個分叉)batch import
help wantedkind/enhancement

倉庫指標

星標
 (13,906 顆星)
PR 合併指標
 (平均合併 4天 2小時) (30 天內合併 28 個 PR)

描述

ipfs add should have an option that lets the user specify a hash that is known ahead of time. Then when IPFS computes the hash, if they don't match, adding should fail with an error.

This defends against corruption during adding, or lets the user detect that the file was corrupted before it was added at all (for example, a truncated download).

In theory this can also be an optimization, where if the IPFS repo already has a file with the given hash, the file doesn't need to be hashed or added at all.

This depends on the user being able to compute the hash in advance. If the file came from IPFS, then that's not a problem. Otherwise, applications need to be able to compute IPFS hashes for themselves (see #1953).

貢獻者指南