Skip to content

Commit 3e32ff5

Browse files
author
Myles Borins
committed
Revert "fs: deprecate fs.read's string interface"
This reverts commit 1124de2 which landed in nodejs#4525 This commit has broken both npm + node-gyp How did it break npm? Deprecating fs.read's string interface includes `internal/util` Currently npm's dep tree includes an old version of graceful-fs that is monkey patching fs. As such everything explodes when trying to require `internal/util` nodejs#5102 is waiting for review but has not landed. We should revert ASAP to fix master while we decide what to do.
1 parent 1693349 commit 3e32ff5

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

lib/fs.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const isWindows = process.platform === 'win32';
3535

3636
const DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
3737
const errnoException = util._errnoException;
38-
const printDeprecation = require('internal/util').printDeprecationMessage;
3938

4039
function throwOptionsError(options) {
4140
throw new TypeError('Expected options to be either an object or a string, ' +
@@ -585,14 +584,9 @@ fs.openSync = function(path, flags, mode) {
585584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
586585
};
587586

588-
var readWarned = false;
589587
fs.read = function(fd, buffer, offset, length, position, callback) {
590588
if (!(buffer instanceof Buffer)) {
591589
// legacy string interface (fd, length, position, encoding, callback)
592-
readWarned = printDeprecation('fs.read\'s legacy String interface ' +
593-
'is deprecated. Use the Buffer API as ' +
594-
'mentioned in the documentation instead.',
595-
readWarned);
596590
const cb = arguments[4];
597591
const encoding = arguments[3];
598592

@@ -642,17 +636,12 @@ function tryToStringWithEnd(buf, encoding, end, callback) {
642636
callback(e, buf, end);
643637
}
644638

645-
var readSyncWarned = false;
646639
fs.readSync = function(fd, buffer, offset, length, position) {
647640
var legacy = false;
648641
var encoding;
649642

650643
if (!(buffer instanceof Buffer)) {
651644
// legacy string interface (fd, length, position, encoding, callback)
652-
readSyncWarned = printDeprecation('fs.readSync\'s legacy String interface' +
653-
'is deprecated. Use the Buffer API as ' +
654-
'mentioned in the documentation instead.',
655-
readSyncWarned);
656645
legacy = true;
657646
encoding = arguments[3];
658647

0 commit comments

Comments
 (0)