Socket
Socket
Sign inDemoInstall

archiver

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archiver - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

24

lib/core.js

@@ -377,3 +377,3 @@ /**

Archiver.prototype.directory = function(dirpath) {
Archiver.prototype.directory = function(dirpath, destpath, data) {
if (this._state.finalize || this._state.aborted) {

@@ -386,2 +386,18 @@ this.emit('error', new Error('directory: queue closed'));

dirpath = util.sanitizePath(dirpath);
dirpath = util.trailingSlashIt(dirpath);
if (typeof destpath === 'string') {
destpath = util.sanitizePath(destpath);
destpath = destpath === '' ? '' : util.trailingSlashIt(destpath);
} else if (destpath === false) {
destpath = '';
} else {
destpath = dirpath;
}
if (typeof data !== 'object') {
data = {};
}
var self = this;

@@ -394,3 +410,7 @@

results.forEach(function(file) {
self._append(file.path, { stats: file.stats });
var entryData = util._.extend({}, data);
entryData.name = destpath + file.relative;
entryData.stats = file.stats;
self._append(file.path, entryData);
});

@@ -397,0 +417,0 @@ }

12

lib/util/index.js

@@ -93,3 +93,3 @@ /**

var filepath = path.join.apply(path, arguments);
return filepath.replace(/\\/g, '/').replace(/:/g, '').replace(/^\/+/, '');
return filepath.replace(/\\/g, '/').replace(/:/g, '').replace(/^(\.\.\/|\.\/|\/)+/, '');
};

@@ -106,3 +106,3 @@

util.walkdir = function(dirpath, callback) {
util.walkdir = function(dirpath, base, callback) {
var results = [];

@@ -113,2 +113,7 @@

if (typeof base === 'function') {
callback = base;
base = dirpath;
}
fs.readdir(dirpath, function(err, list) {

@@ -132,2 +137,3 @@ var i = 0;

path: dirpath + file,
relative: path.relative(base, dirpath + file).replace(/\\/g, '/'),
stats: stats

@@ -137,3 +143,3 @@ });

if (stats && stats.isDirectory()) {
util.walkdir(dirpath + file, function(err, res) {
util.walkdir(dirpath + file, base, function(err, res) {
results = results.concat(res);

@@ -140,0 +146,0 @@ next();

{
"name": "archiver",
"version": "0.14.0",
"version": "0.14.1",
"description": "a streaming interface for archive generation",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/ctalkington/node-archiver",

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

# Archiver v0.14.0 [![Build Status](https://travis-ci.org/ctalkington/node-archiver.svg?branch=master)](https://travis-ci.org/ctalkington/node-archiver)
# Archiver v0.14.1 [![Build Status](https://travis-ci.org/ctalkington/node-archiver.svg?branch=master)](https://travis-ci.org/ctalkington/node-archiver)

@@ -70,8 +70,15 @@ a streaming interface for archive generation

#### directory(dirpath)
#### directory(dirpath[, destpath, data])
Appends a directory, recusively, given its dirpath.
Appends a directory and its files, recusively, given its dirpath. This is meant to be a simplier approach to something previously only possible with `bulk`. The use of `destpath` allows one to define a custom destination path within the resulting archive and `data` allows for setting data on each entry appended.
```js
// mydir/ -> archive.ext/mydir/
archive.directory('mydir');
// mydir/ -> archive.ext/abc/
archive.directory('mydir', 'abc');
// mydir/ -> archive.ext/
archive.directory('mydir', false, { date: new Date() });
```

@@ -78,0 +85,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc