Created
September 8, 2019 18:41
-
-
Save pgebheim/001b1e0fcd172989ff769397aa31786f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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