Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ var Archiver = function(format, options) {
};

this._streams = [];

this._loggedBulkDeprecation = false;
};

inherits(Archiver, Transform);
Expand Down Expand Up @@ -555,6 +557,16 @@ Archiver.prototype.append = function(source, data) {
* @return {this}
*/
Archiver.prototype.bulk = function(mappings) {
if (!this._loggedBulkDeprecation) {
this._loggedBulkDeprecation = true;
var warning = 'Archiver.bulk() deprecated since 0.21.0';
if (typeof process !== 'undefined' && typeof process.emitWarning !== 'undefined') {
process.emitWarning(warning, 'DeprecationWarning');
} else {
console.warn(warning);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry there's been a misunderstanding,

I was thinking into something like:

var warning = 'Archiver.bulk() deprecated since 0.21.0'
if (typeof process !== 'undefined' && typeof process.emitWarning !== 'undefined') {
    process.emitWarning(warning, 'DeprecationWarning');
} else {
    console.warn(warning);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that can be done as well. Do you want me to leave the _loggedBulkDeprecation in there or do you want me to log on each call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed 86b1123 which deals with the repeated string. If you want me to drop the _loggedBulkDeprecation, let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nice improvement imo, let's see what @ctalkington thinks

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 test of console is overkill, also you might want to declare a variable for the error string to avoid repeating it.

Then 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got ya.


if (this._state.finalize || this._state.aborted) {
this.emit('error', new Error('bulk: queue closed'));
return this;
Expand Down