From e3a1187ef94d5fc627768cee13457417e7ea0035 Mon Sep 17 00:00:00 2001 From: Corey James <35980137+coreyjjames@users.noreply.github.com> Date: Mon, 24 Sep 2018 14:08:49 -0400 Subject: [PATCH] Fixed the fs.read() example in doc. The error checking statements were using the wrong variable name (#449) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2f51838..6de7f7a 100644 --- a/README.md +++ b/README.md @@ -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.