You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
I'm building a deploy step for a simple JS app. My understanding of the steps required to propogate something to IPFS via the JS wrapper is:
1. Build App (via Webpack etc)
2. Create buffers / readable streams for built files
3. Spawn IPFS node via `let node = new IPFS()`
4. Upload files via `node.files.add`
Write now, the code is as follows:
letnode;returnnewRSVP.Promise(function(resolve,reject){node=newIPFS();node.on('ready',()=>{// file here will eventually comprise a built web appletfile=newnode.types.Buffer('/hello.txt');node.files.add([{path: '/hello.txt',content: file}],function(err,files){if(err){returnreject(err);}returnresolve(files);});});}).finally(()=>{if(node)node.stop();});
This resolves a hash successfully without throwing err. However, when I navigate to https://gateway.ipfs.io/ipfs/${files[0].hash}, the file doesn't actually resolve.
What am I missing here?
I'm guessing that while the file has uploaded to the local node, it gets stopped before the file has propagated to a permanent node on the network. If that's correct, how do I know how to keep the local node alive long enough for it to propagate to the gateway?