From 451a44c4b5c9156063e1dac60d01722f0e7136b7 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Thu, 23 Nov 2017 13:41:47 -0800 Subject: [PATCH] =?UTF-8?q?:wrench:=20Don=E2=80=99t=20use=20deprecated=20`?= =?UTF-8?q?new=20Buffer()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/asar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/common/asar.js b/lib/common/asar.js index e35efc279958..6eaddebf2618 100644 --- a/lib/common/asar.js +++ b/lib/common/asar.js @@ -482,7 +482,7 @@ } if (info.size === 0) { return process.nextTick(function () { - callback(null, encoding ? '' : new Buffer(0)) + callback(null, encoding ? '' : Buffer.alloc(0)) }) } if (info.unpacked) { @@ -490,7 +490,7 @@ return fs.readFile(realPath, options, callback) } - const buffer = new Buffer(info.size) + const buffer = Buffer.alloc(info.size) const fd = archive.getFd() if (!(fd >= 0)) { return notFoundError(asarPath, filePath, callback) @@ -519,7 +519,7 @@ if (options) { return '' } else { - return new Buffer(0) + return Buffer.alloc(0) } } if (info.unpacked) { @@ -538,7 +538,7 @@ throw new TypeError('Bad arguments') } const {encoding} = options - const buffer = new Buffer(info.size) + const buffer = Buffer.alloc(info.size) const fd = archive.getFd() if (!(fd >= 0)) { notFoundError(asarPath, filePath) @@ -611,7 +611,7 @@ encoding: 'utf8' }) } - const buffer = new Buffer(info.size) + const buffer = Buffer.alloc(info.size) const fd = archive.getFd() if (!(fd >= 0)) { return