Closed
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?