Use Buffer.alloc instead of the Buffer constructor.

https://circleci.com/gh/meteor/meteor/32465
This commit is contained in:
Ben Newman
2019-04-12 18:46:01 -04:00
parent 9171b568a4
commit ae8f217065

View File

@@ -1878,7 +1878,7 @@ files.unwatchFile = function (...args) {
};
files.readBufferWithLengthAndOffset = function (filename, length, offset) {
var data = new Buffer(length);
var data = Buffer.alloc(length);
// Read the data from disk, if it is non-empty. Avoid doing IO for empty
// files, because (a) unnecessary and (b) fs.readSync with length 0
// throws instead of acting like POSIX read: