Skip to content

Commit

Permalink
add mode parameter to symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
leemhenson committed Nov 10, 2020
1 parent c0c5512 commit 08dbbb0
Show file tree
Hide file tree
Showing 3 changed files with 1,464 additions and 10 deletions.
7 changes: 6 additions & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,9 +849,10 @@ Archiver.prototype.setModule = function(module) {
*
* @param {String} filepath The symlink path (within archive).
* @param {String} target The target path (within archive).
* @param {Number} mode Sets the entry permissions.
* @return {this}
*/
Archiver.prototype.symlink = function(filepath, target) {
Archiver.prototype.symlink = function(filepath, target, mode) {
if (this._state.finalize || this._state.aborted) {
this.emit('error', new ArchiverError('QUEUECLOSED'));
return this;
Expand All @@ -878,6 +879,10 @@ Archiver.prototype.symlink = function(filepath, target) {
data.linkname = target.replace(/\\/g, '/');
data.sourceType = 'buffer';

if (typeof mode === "number") {
data.mode = mode;
}

this._entriesCount++;
this._queue.push({
data: data,
Expand Down
Loading

0 comments on commit 08dbbb0

Please sign in to comment.