-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Description
fs.read
and fs.readSync
support a little-known alternative usage that lets you get back a String instead of Buffer.
// `fd` is a descriptor to a file that contains 'xyz'
fs.read(fd, 3, 0, 'utf-8',function(err, str, bytesRead) {
// str is 'xyz'
});
var r = fs.readSync(fd, 3, 0, 'utf-8'); // returns ['xyz', 3] wut?
This doesn't match what node does elsewhere. While preparing this PR, I experienced the very real cost that supporting this old usage causes. It increases the surface area for bugs in node core, as well as user code.
Can we get stats on how much this is used?
Can we, at least as a start, start printing a deprecation warning for this usage?
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.