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 upWrong example at documentation page #861
Closed
Comments
This comment has been minimized.
This comment has been minimized.
|
thanks, fixed! |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
at documentation site https://github.com/feross/webtorrent/blob/master/docs/get-started.md we have a section called Download and save a torrent (in Node.js) where there's an example code.
This example works well but you're showing messages at console using console.error:
fs.writeFile(file.name, buffer, function (err) {
console.error('Error saving ' + file.name)
})
But it's downloading successfully.
Probably the best example should be
fs.writeFile(file.name, buffer, function (err) {
if (err) {
console.error('Error saving ' + file.name)
} else {
console.log('File saved ' + file.name);
}
})
As I could see at writeFile documentation (https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) the 3rd parameters is for error, it's for a callback function.
This creates confusion with new developers using the library, because it's download successfully and at the console it show error messages.