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 upError in the browser when trying to seed an array of strings #1483
Comments
This comment has been minimized.
This comment has been minimized.
|
Try this const { recipes } = this.props;
const recipesSerialized = JSON.stringify(recipes);
const recipesBuffer = Buffer.from(recipesSerialized);
const client = new WebTorrent();
client.seed(recipesBuffer, function seedTorrent({ magnetURI }) {
console.log('Client is seeding ' + magnetURI);
QRCode.toDataURL(magnetURI)
.then(url => {
this.setState({ exportDialogIsOpen: true, qrCodeDataUrl: url });
})
.catch(err => {
// TODO show snackbar
console.error(err);
});
});see here for details on client.seed() You're passing an array of strings, and it interprets strings as filesystem paths. |
This comment has been minimized.
This comment has been minimized.
|
works perfectly, thank you! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of WebTorrent?
^0.102.1
What operating system and Node.js version?
n/A
What browser and version? (if using WebTorrent in the browser)
Chrome 68
What did you expect to happen?
Expected to be able to seed a stringified JSON blob.
What actually happened?
Received an error
Uncaught Error: filesystem paths do not work in the browser