如何检查给定的 <ipfs_hash> 是否已完全下载?
How to check is the given <ipfs_hash> is already fully downloaded or not?
首先,当我 运行 ipfs --offline block stat <ipfs_hash>
时,如果散列在本地不存在,我会收到以下消息:Error: blockservice: key not found
.
之后我 运行 如下:ipfs object stat <ipfs_hash>
并且在获得有效输出之后
我再次运行 ipfs --offline block stat <ipfs_hash>
,现在它总是return有效信息(因此不会给出错误)甚至没有下载哈希。因此,假设如果 ipfs --offline block stat <ipfs_hash>
给出并且 Error
消息不相关,则给定的散列是在本地下载的。
如何解决此问题以检测所询问的散列是否已完全下载?
我可以做类似 ipfs refs local | grep <hash>
的事情,但我不想一直获取所有哈希值,当存在数百个哈希值时它会变慢。
ipfs files stat --with-local --size <path>
returns 请求的 ipfs 哈希的下载百分比。如果它 100.00%
那么我们可以验证它是否已完全下载到本地 ipfs 存储库中。
ipfs files stat <path> - Display file status.
--with-local bool - Compute the amount of the dag that is local, and if possible the total size.
--size bool - Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options. ```
$ hash="QmPHTrNR9yQYRU4Me4nSG5giZVxb4zTtEe1aZshgByFCFS"
$ ipfs files stat --with-local --size /ipfs/$hash
407624015
Local: 408 MB of 408 MB (100.00%)
首先,当我 运行 ipfs --offline block stat <ipfs_hash>
时,如果散列在本地不存在,我会收到以下消息:Error: blockservice: key not found
.
之后我 运行 如下:
ipfs object stat <ipfs_hash>
并且在获得有效输出之后我再次运行
ipfs --offline block stat <ipfs_hash>
,现在它总是return有效信息(因此不会给出错误)甚至没有下载哈希。因此,假设如果ipfs --offline block stat <ipfs_hash>
给出并且Error
消息不相关,则给定的散列是在本地下载的。
如何解决此问题以检测所询问的散列是否已完全下载?
我可以做类似 ipfs refs local | grep <hash>
的事情,但我不想一直获取所有哈希值,当存在数百个哈希值时它会变慢。
ipfs files stat --with-local --size <path>
returns 请求的 ipfs 哈希的下载百分比。如果它 100.00%
那么我们可以验证它是否已完全下载到本地 ipfs 存储库中。
ipfs files stat <path> - Display file status. --with-local bool - Compute the amount of the dag that is local, and if possible the total size. --size bool - Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options. ```
$ hash="QmPHTrNR9yQYRU4Me4nSG5giZVxb4zTtEe1aZshgByFCFS"
$ ipfs files stat --with-local --size /ipfs/$hash
407624015
Local: 408 MB of 408 MB (100.00%)