Fixed the fs.read() example in doc. The error checking statements were using the wrong variable name (#449)

This commit is contained in:
Corey James 2018-09-24 14:08:49 -04:00 committed by David Humphrey
parent fd3de6be2c
commit e3a1187ef9
1 changed files with 3 additions and 3 deletions

View File

@ -908,11 +908,11 @@ Example:
```javascript
fs.open('/myfile', 'r', function(err, fd) {
if(err) throw error;
if(err) throw err;
// Determine size of file
fs.fstat(fd, function(err, stats) {
if(err) throw error;
if(err) throw err;
// Create a buffer large enough to hold the file's contents
var nbytes = expected = stats.size;
@ -923,7 +923,7 @@ fs.open('/myfile', 'r', function(err, fd) {
length = length || buffer.length - read;
fs.read(fd, buffer, offset, length, position, function(err, nbytes) {
if(err) throw error;
if(err) throw err;
// nbytes is now the number of bytes read, between 0 and buffer.length.
// See if we still have more bytes to read.