ipfs-only-hash 和 JavaScript

发布于 2025-01-17 08:45:57 字数 472 浏览 3 评论 0原文

有人可以帮我做“仅IPFS的锤子”吗?我对JavaScript我很新,不知道如何将其添加到我的HTML和JS文件中...

我需要计算图像文件的IPFS哈希(例如,使用< lt; input type =“ file”。 。>)。 我发现的是'ipfs-inly-hash',及其可能的实现(在这里 - 字符串的哈希):

const Hash = require('ipfs-only-hash')
Hash.of('hi').then(console.log)

但是我在“ require”上遇到了所有的错误,试图将其更改为“ IPFS-folly-hash”'''',然后再次出现错误...我在HTML-JS文件中使用它?

Could somebody help me with 'ipfs-only-hash'? I'm pretty new with JavaScript and do not know how to add it to my html and js files...

I need to calculate an IPFS hash of the image file (for example, upload with <input type="file" ..>).
What I found is 'ipfs-only-hash', and its possible implementation (here - hash of the string):

const Hash = require('ipfs-only-hash')
Hash.of('hi').then(console.log)

But I got all the time errors on "require", tried to change it to 'import Hash from "ipfs-only-hash"', and again got errors... Where and how should I use it in my html-js files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文