From 43fc05cbf71543c609eadaa878d4c79faf46cf25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D0=B2=D0=BE=D1=80=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Sat, 3 Mar 2018 13:25:37 +0300 Subject: [PATCH] Avoid using deprecated Buffer constructor Buffer.concat([]) returns an empty buffer all the way down to 0.8.x. Refs: https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor --- lib/core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core.js b/lib/core.js index c7d0b61f4..812952a82 100644 --- a/lib/core.js +++ b/lib/core.js @@ -492,14 +492,14 @@ Archiver.prototype._updateQueueTaskWithStats = function(task, stats) { task.data.type = 'directory'; task.data.sourcePath = util.trailingSlashIt(task.filepath); task.data.sourceType = 'buffer'; - task.source = new Buffer(0); + task.source = Buffer.concat([]); } else if (stats.isSymbolicLink() && this._moduleSupports('symlink')) { var linkPath = fs.readlinkSync(task.filepath); var dirName = path.dirname(task.filepath); task.data.type = 'symlink'; task.data.linkname = path.relative(dirName, path.resolve(dirName, linkPath)); task.data.sourceType = 'buffer'; - task.source = new Buffer(0); + task.source = Buffer.concat([]); } else { if (stats.isDirectory()) { this.emit('warning', new ArchiverError('DIRECTORYNOTSUPPORTED', task.data)); @@ -873,7 +873,7 @@ Archiver.prototype.symlink = function(filepath, target) { this._entriesCount++; this._queue.push({ data: data, - source: new Buffer(0) + source: Buffer.concat([]) }); return this;