Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upIs there a way to get the raw data from a file and embed it in a page? #1346
Comments
This comment has been minimized.
This comment has been minimized.
// file is a webtorrent file object
file.getBuffer(function (err, buffer) {
if (err) throw err
let text = buffer.toString('utf8')
console.log(text) //or render to DOM
}) |
This comment has been minimized.
This comment has been minimized.
|
Thanks for sharing a code example, @KayleePop :) @ki4jgt There are more methods of accessing file data in the docs: http://webtorrent.io/docs |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of WebTorrent?
Current -- using CDN
What operating system and Node.js version?
Windows -- in browser
What browser and version? (if using WebTorrent in the browser)
Mozilla 59
What did you expect to happen?
N/A
What actually happened?
I'm working on a P2P video-sharing platform in the browser. I would like to read a txt file -- containing video information -- and then display its contents within the page.