Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-7z

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-7z - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

TODO.md

8

CHANGELOG.md
Changelog
=========
### `v0.4.0` 2015-12-06
* Feature: Add a `raw` parameter to the `options` object. Given
values are *Array* (e.g. `[ '-i!*.png', '-i*.jpg' ]`).
* Feature: Add support for `.rar` archives.
* Fix: Bug with `Zip.list` sometimes occurs (commit
748091463961110449e63d7ea6b9628749104f15).
### `v0.3.0` 2015-02-06

@@ -5,0 +13,0 @@

2

lib/add.js

@@ -27,3 +27,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za a "' + archive + '" ' + files;
var command = '7z a "' + archive + '" ' + files;

@@ -30,0 +30,0 @@ // Start the command

@@ -25,3 +25,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za d "' + archive + '" ' + files;
var command = '7z d "' + archive + '" ' + files;

@@ -28,0 +28,0 @@ // Start the command

@@ -23,3 +23,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za e "' + archive + '" -o"' + dest + '" ';
var command = '7z e "' + archive + '" -o"' + dest + '" ';

@@ -26,0 +26,0 @@ // Start the command

@@ -23,3 +23,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za x "' + archive + '" -o"' + dest + '" ';
var command = '7z x "' + archive + '" -o"' + dest + '" ';

@@ -26,0 +26,0 @@ // Start the command

@@ -23,8 +23,9 @@ 'use strict';

/* jshint maxlen: 130 */
var regex = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([\.DA]+) +(\d+)[ \d]+ (.+)/;
var regex = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([\.DA]+) +(\d+) +\d+ +(.+)/;
/* jshint maxlen: 80 */
// Create a string that can be parsed by `run`.
var command = '7za l "' + archive + '" ';
var command = '7z l "' + archive + '" ';
var buffer = ""; //Store imcomplete line of a progress data.
// Start the command

@@ -38,2 +39,10 @@ u.run(command, options)

var entries = [];
// Last progress had an incomplete line. Prepend it to the data and clear
// buffer.
if (buffer.length > 0) {
data = buffer + data;
buffer = "";
}
data.split('\n').forEach(function (line) {

@@ -54,3 +63,2 @@

} else {
// Parse the stdout to find entries

@@ -65,5 +73,9 @@ var res = regex.exec(line);

};
entries.push(e);
}
// Line may be incomplete, Save it to the buffer.
else buffer = line;
}

@@ -70,0 +82,0 @@ });

@@ -22,3 +22,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za t "' + archive + '"';
var command = '7z t "' + archive + '"';

@@ -25,0 +25,0 @@ // Start the command

@@ -23,3 +23,3 @@ 'use strict';

// Create a string that can be parsed by `run`.
var command = '7za u "' + archive + '" "' + files + '"';
var command = '7z u "' + archive + '" "' + files + '"';

@@ -26,0 +26,0 @@ // Start the command

{
"name": "node-7z",
"version": "0.3.0",
"version": "0.4.0",
"description": "A Node.js wrapper for 7-Zip",

@@ -22,3 +22,4 @@ "main": "lib/index.js",

"contributors": [
"HelloGravity"
"HelloGravity",
"sketchpunk"
],

@@ -25,0 +26,0 @@ "license": "ISC",

@@ -37,8 +37,8 @@ node-7z

You must have the `7za` executable available in your PATH or in the same
You must have the `7z` executable available in your PATH or in the same
directory of your `package.json` file.
> On Debian an Ubuntu install the `p7zip-full` package.
> On Debian and Ubuntu install the `p7zip-full` package.
> On Windows use the `7za.exe` ([link here](http://netcologne.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip))
> On Windows use the `7z.exe` ([link here](http://sourceforge.net/projects/sevenzip/files/7-Zip/))
> binary.

@@ -227,2 +227,28 @@

### Raw inputs
> Thanks to sketchpunk #9 for this one
Sometimes you just want to use the lib as the original command line. For
instance you want to apply to switches with different values (e.g.:
`-i!*.jpg -i!*.png` to target only two types of extensions).
In such cases the default behavior of the `options` argument is not enough. You
can use the custom `raw` key in your `options` object and pass it an *Array* of
values.
```js
var archive = new Zip();
archive.list('archive.zip', {
raw: [ '-i!*.jpg', '-i!*.png' ], // only images
})
.progress(function (files) {
// Do stuff with files...
})
.then(function () {
// Do stuff...
});
```
***

@@ -229,0 +255,0 @@ With :heart: from [quentinrossetti](http://quentinrossetti.me/)

@@ -64,2 +64,10 @@ /*global describe, it */

it('should works with the `raw` switch', function () {
var r = switches({
raw: ['-i!*.jpg', '-i!*.png'],
});
expect(r).to.contain('-i!*.jpg');
expect(r).to.contain('-i!*.png');
});
});

@@ -41,5 +41,16 @@ 'use strict';

}
// Allow raw switches to be added to the command, repeating switches like
// -i is not possible otherwise.
else if (s === 'raw') {
switches.raw.forEach(function (rawValue) {
a.push(rawValue);
});
}
else if (switches[s].indexOf(' ') === -1) {
a.push('-' + s + switches[s]);
} else {
}
else {
a.push('-' + s + '"' + switches[s] + '"');

@@ -46,0 +57,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc