From 9f6d226f11970bf8a395413dd110ceeea2f10f06 Mon Sep 17 00:00:00 2001 From: Antoine Bluchet Date: Mon, 12 Dec 2016 06:15:10 +0100 Subject: [PATCH] fix bulk warning spam (#208) --- lib/core.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/core.js b/lib/core.js index 3c4ed4d3..10a9e597 100644 --- a/lib/core.js +++ b/lib/core.js @@ -18,6 +18,10 @@ var Transform = require('readable-stream').Transform; var win32 = process.platform === 'win32'; +if (process._loggedBulkDeprecation === undefined) { + process._loggedBulkDeprecation = false; +} + /** * @constructor * @param {String} format The archive format to use. @@ -60,8 +64,6 @@ var Archiver = function(format, options) { }; this._streams = []; - - this._loggedBulkDeprecation = false; }; inherits(Archiver, Transform); @@ -559,8 +561,8 @@ Archiver.prototype.append = function(source, data) { * @return {this} */ Archiver.prototype.bulk = function(mappings) { - if (!this._loggedBulkDeprecation) { - this._loggedBulkDeprecation = true; + if (process._loggedBulkDeprecation === false) { + process._loggedBulkDeprecation = true; var warning = 'Archiver.bulk() deprecated since 0.21.0'; if (typeof process !== 'undefined' && typeof process.emitWarning !== 'undefined') { process.emitWarning(warning, 'DeprecationWarning'); @@ -901,4 +903,4 @@ module.exports = Archiver; * when working with methods like `directory` or `glob`. * @property {fs.Stats} [stats] Sets the fs stat data for this entry allowing * for reduction of fs stat calls when stat data is already known. - */ \ No newline at end of file + */