Socket
Socket
Sign inDemoInstall

archiver

Package Overview
Dependencies
8
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.1.0

7

CHANGELOG.md
## Changelog
**2.1.0** — <small>_October 12th, 2017_</small> — [Diff](https://github.com/archiverjs/node-archiver/compare/2.0.3...2.1.0)
- refactor: `directory` now uses glob behind the scenes. should fix some directory recursion issues. (#267, #275)
- docs: more info in quick start. (#284)
**2.0.3** — <small>_August 25th, 2017_</small> — [Diff](https://github.com/archiverjs/node-archiver/compare/2.0.2...2.0.3)
- bugfix: revert #261 due to potential issues with editing entryData in special cases.
- bugfix: add var to entryData in glob callback (GH#273)
- bugfix: add var to entryData in glob callback (#273)

@@ -8,0 +13,0 @@ **2.0.2** — <small>_August 25th, 2017_</small> — [Diff](https://github.com/archiverjs/node-archiver/compare/2.0.1...2.0.2)

61

lib/core.js

@@ -13,3 +13,2 @@ /**

var path = require('path');
var walkdir = require('walkdir');
var util = require('archiver-utils');

@@ -315,3 +314,3 @@

if (data.name.slice(-1) === '/') {
if (data.type !== 'symlink' && data.name.slice(-1) === '/') {
isDir = true;

@@ -420,3 +419,3 @@ data.type = 'directory';

fs.stat(task.filepath, function(err, stats) {
fs.lstat(task.filepath, function(err, stats) {
if (this._state.aborted) {

@@ -501,4 +500,5 @@ setImmediate(callback);

} else if (stats.isSymbolicLink() && this._moduleSupports('symlink')) {
var linkPath = fs.readlinkSync(task.filepath);
task.data.type = 'symlink';
task.data.linkname = fs.readlinkSync(task.filepath);
task.data.linkname = path.relative(path.dirname(task.filepath), path.resolve(linkPath));
task.data.sourceType = 'buffer';

@@ -519,2 +519,3 @@ task.source = new Buffer(0);

task.data = this._normalizeEntryData(task.data, stats);
return task;

@@ -630,7 +631,23 @@ };

function onWalkPath(filepath, stats){
var globOptions = {
stat: false,
dot: true,
cwd: dirpath
};
function onGlobEnd() {
this._pending--;
this._maybeFinalize();
}
function onGlobError(err) {
this.emit('error', err);
}
function onGlobMatch(match){
var ignoreMatch = false;
var entryData = _.extend({}, data);
entryData.name = path.relative(dirpath, filepath).replace(/\\/g, '/');
entryData.name = match;
entryData.prefix = destpath;
entryData.stats = stats;
match = globber._makeAbs(match);

@@ -641,3 +658,5 @@ try {

if (typeof entryData !== 'object') {
if (entryData === false) {
ignoreMatch = true;
} else if (typeof entryData !== 'object') {
throw new ArchiverError('DIRECTORYFUNCTIONINVALIDDATA', { dirpath: dirpath });

@@ -651,22 +670,14 @@ }

this._append(filepath, entryData);
}
if (ignoreMatch) {
return;
}
function onWalkEnd() {
this._pending--;
this._maybeFinalize();
this._append(match, entryData);
}
function onWalkError(errMsg, err) {
this.emit('error', 'directory: ' + errMsg, err);
}
var globber = glob('**', globOptions);
globber.on('error', onGlobError.bind(this));
globber.on('match', onGlobMatch.bind(this));
globber.on('end', onGlobEnd.bind(this));
var walker = walkdir(dirpath);
walker.on('error', onWalkError.bind(this));
walker.on('directory', onWalkPath.bind(this));
walker.on('file', onWalkPath.bind(this));
walker.on('link', onWalkPath.bind(this));
walker.on('end', onWalkEnd.bind(this));
return this;

@@ -726,3 +737,3 @@ };

function onGlobError(err) {
this.emit('error', 'glob: ' + err);
this.emit('error', err);
}

@@ -729,0 +740,0 @@

{
"name": "archiver",
"version": "2.0.3",
"version": "2.1.0",
"description": "a streaming interface for archive generation",

@@ -39,4 +39,3 @@ "homepage": "https://github.com/archiverjs/node-archiver",

"tar-stream": "^1.5.0",
"zip-stream": "^1.2.0",
"walkdir": "^0.0.11"
"zip-stream": "^1.2.0"
},

@@ -43,0 +42,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

# Archiver v2.0.3
# Archiver

@@ -29,2 +29,3 @@ [![Build Status](https://travis-ci.org/archiverjs/node-archiver.svg?branch=master)](https://travis-ci.org/archiverjs/node-archiver) [![Build status](https://ci.appveyor.com/api/projects/status/38kqu3yp159nodxe/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-archiver/branch/master)

// listen for all archive data to be written
// 'close' event is fired only when a file descriptor is involved
output.on('close', function() {

@@ -35,2 +36,9 @@ console.log(archive.pointer() + ' total bytes');

// This event is fired when the data source is drained no matter what was the data source.
// It is not part of this library but rather from the NodeJS Stream API.
// @see: https://nodejs.org/api/stream.html#stream_event_end
output.on('end', function() {
console.log('Data has been drained');
});
// good practice to catch warnings (ie stat failures and other non-blocking errors)

@@ -78,2 +86,3 @@ archive.on('warning', function(err) {

// finalize the archive (ie we are done appending files but streams have to finish yet)
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand
archive.finalize();

@@ -88,2 +97,2 @@ ```

_Formats will be changing in the next few releases to implement a middleware approach._
_Formats will be changing in the next few releases to implement a middleware approach._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc