Service Worker 网关有什么用?
What are service worker gateways used for?
我注意到您可以使用 js-ipfs
在 Service Worker 中启动节点。我很想知道服务工作者实现和简单地导入捆绑的 javascript 库之间的区别是什么。
我目前只是在 add
和 pin
文件中使用导入的 js 库,它似乎工作正常。用户浏览器上的节点是否真的 运行?
当你 运行 js-ipfs in your web app, it is a full IPFS node running in the browser. You can talk to it using programmatic interface (ipfs.add
, ipfs.cat
etc), just like you described, but it is unable to answer to regular HTTP requests because it can't open TCP port to start HTTP server. This usually is not a problem, but if you want to display an image downloaded from IPFS you need to fetch it via cat
and inline it as Data URL.
Service Worker 中的 运行ning js-ipfs 在常规编程接口之上为您提供的功能是为 /ipfs/{CID}
路径的 HTTP 请求提供响应的能力,就像 regular gateways 会做。
我注意到您可以使用 js-ipfs
在 Service Worker 中启动节点。我很想知道服务工作者实现和简单地导入捆绑的 javascript 库之间的区别是什么。
我目前只是在 add
和 pin
文件中使用导入的 js 库,它似乎工作正常。用户浏览器上的节点是否真的 运行?
当你 运行 js-ipfs in your web app, it is a full IPFS node running in the browser. You can talk to it using programmatic interface (ipfs.add
, ipfs.cat
etc), just like you described, but it is unable to answer to regular HTTP requests because it can't open TCP port to start HTTP server. This usually is not a problem, but if you want to display an image downloaded from IPFS you need to fetch it via cat
and inline it as Data URL.
Service Worker 中的 运行ning js-ipfs 在常规编程接口之上为您提供的功能是为 /ipfs/{CID}
路径的 HTTP 请求提供响应的能力,就像 regular gateways 会做。