Skip to content

Commit db09275

Browse files
committed
fix: deprecated warning on isbinaryfile
1 parent 99cd385 commit db09275

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/tools/isbinaryfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function(bytes, size) {
1818
}
1919
var descriptor = fs.openSync(file, 'r');
2020
try {
21-
bytes = new Buffer(max_bytes);
21+
bytes = Buffer.alloc(max_bytes);
2222
size = fs.readSync(descriptor, bytes, 0, bytes.length, 0);
2323
} finally {
2424
fs.closeSync(descriptor);
@@ -32,7 +32,7 @@ module.exports = function(bytes, size) {
3232

3333
fs.open(file, 'r', function(err, descriptor){
3434
if (err) return callback(err);
35-
var bytes = new Buffer(max_bytes);
35+
var bytes = Buffer.alloc(max_bytes);
3636
// Read the file with no encoding for raw buffer access.
3737
fs.read(descriptor, bytes, 0, bytes.length, 0, function(err, size, bytes){
3838
fs.close(descriptor, function(err2){

0 commit comments

Comments
 (0)