Skip to content

Instantly share code, notes, and snippets.

@pgebheim
Created September 8, 2019 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgebheim/001b1e0fcd172989ff769397aa31786f to your computer and use it in GitHub Desktop.
Save pgebheim/001b1e0fcd172989ff769397aa31786f to your computer and use it in GitHub Desktop.
// this was basically copied directly from the ipfs documentation
const validCID = 'QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF' // await loadIpfsHashFromGithub();
const stream = ipfs.getReadableStream(validCID)
pull(
stream,
pull.collect((err, files) => {
if (err) {
throw err
}
files.forEach((file) => {
ipfs.addPullStream({ path: file.path.toString, content: file.content});
console.log('Serving: ', file.path.toString())
})
})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment