@@ -455,7 +455,7 @@ Synchronous version of `fs.read`. Returns the number of `bytesRead`.
455455## fs.readFile(filename[ , options] , callback)
456456
457457* ` filename ` {String}
458- * ` options ` {Object}
458+ * ` options ` {Object | String }
459459 * ` encoding ` {String | Null} default = ` null `
460460 * ` flag ` {String} default = ` 'r' `
461461* ` callback ` {Function}
@@ -472,6 +472,10 @@ contents of the file.
472472
473473If no encoding is specified, then the raw buffer is returned.
474474
475+ If ` options ` is a string, then it specifies the encoding. Example:
476+
477+ fs.readFile('/etc/passwd', 'utf8', callback);
478+
475479
476480## fs.readFileSync(filename[ , options] )
477481
@@ -485,7 +489,7 @@ string. Otherwise it returns a buffer.
485489
486490* ` filename ` {String}
487491* ` data ` {String | Buffer}
488- * ` options ` {Object}
492+ * ` options ` {Object | String }
489493 * ` encoding ` {String | Null} default = ` 'utf8' `
490494 * ` mode ` {Number} default = ` 0o666 `
491495 * ` flag ` {String} default = ` 'w' `
@@ -504,6 +508,10 @@ Example:
504508 console.log('It\'s saved!');
505509 });
506510
511+ If ` options ` is a string, then it specifies the encoding. Example:
512+
513+ fs.writeFile('message.txt', 'Hello io.js', 'utf8', callback);
514+
507515## fs.writeFileSync(filename, data[ , options] )
508516
509517The synchronous version of ` fs.writeFile ` .
@@ -512,7 +520,7 @@ The synchronous version of `fs.writeFile`.
512520
513521* ` filename ` {String}
514522* ` data ` {String | Buffer}
515- * ` options ` {Object}
523+ * ` options ` {Object | String }
516524 * ` encoding ` {String | Null} default = ` 'utf8' `
517525 * ` mode ` {Number} default = ` 0o666 `
518526 * ` flag ` {String} default = ` 'a' `
@@ -528,6 +536,10 @@ Example:
528536 console.log('The "data to append" was appended to file!');
529537 });
530538
539+ If ` options ` is a string, then it specifies the encoding. Example:
540+
541+ fs.appendFile('message.txt', 'data to append', 'utf8', callback);
542+
531543## fs.appendFileSync(filename, data[ , options] )
532544
533545The synchronous version of ` fs.appendFile ` .
0 commit comments