Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // this was basically copied directly from the ipfs documentation
  2.  
  3. const validCID = 'QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF' // await loadIpfsHashFromGithub();
  4.  
  5. const stream = ipfs.getReadableStream(validCID)
  6.  
  7. pull(
  8. stream,
  9. pull.collect((err, files) => {
  10. if (err) {
  11. throw err
  12. }
  13.  
  14. files.forEach((file) => {
  15. ipfs.addPullStream({ path: file.path.toString, content: file.content});
  16. console.log('Serving: ', file.path.toString())
  17. })
  18. })
  19. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement