Socket
Socket
Sign inDemoInstall

compressing

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compressing - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0

23

lib/utils.js

@@ -121,3 +121,2 @@ 'use strict';

if (err) return reject(err);
successCount++;

@@ -127,2 +126,12 @@ done();

});
} else if (header.type === 'symlink') {
// symlink
const src = path.join(destDir, header.name);
const target = path.resolve(path.dirname(src), header.linkname);
entryCount++;
fs.symlink(target, src, err => {
if (err) return reject(err);
successCount++;
stream.resume();
});
} else { // directory

@@ -144,8 +153,8 @@ mkdirp(path.join(destDir, header.name), err => {

stream
.on('readable', () => {
let chunk;
while ((chunk = stream.read())) chunks.push(chunk);
})
.on('end', () => resolve(Buffer.concat(chunks)))
.on('error', err => reject(err));
.on('readable', () => {
let chunk;
while ((chunk = stream.read())) chunks.push(chunk);
})
.on('end', () => resolve(Buffer.concat(chunks)))
.on('error', err => reject(err));
});

@@ -152,0 +161,0 @@ };

@@ -59,4 +59,4 @@ 'use strict';

utils.streamToBuffer(opts.source)
.then(buf => yauzl.fromBuffer(buf, yauzlOpts, this[YAUZL_CALLBACK]))
.catch(e => this.emit('error', e));
.then(buf => yauzl.fromBuffer(buf, yauzlOpts, this[YAUZL_CALLBACK]))
.catch(e => this.emit('error', e));
return;

@@ -69,8 +69,8 @@ }

utils.streamToBuffer(srcStream)
.then(buf => {
this._chunks.push(buf);
buf = Buffer.concat(this._chunks);
yauzl.fromBuffer(buf, yauzlOpts, this[YAUZL_CALLBACK]);
})
.catch(e => this.emit('error', e));
.then(buf => {
this._chunks.push(buf);
buf = Buffer.concat(this._chunks);
yauzl.fromBuffer(buf, yauzlOpts, this[YAUZL_CALLBACK]);
})
.catch(e => this.emit('error', e));
});

@@ -90,34 +90,34 @@ }

zipFile
.on('entry', entry => {
const mode = modeFromEntry(entry);
// fileName is buffer by default because decodeStrings = false
if (Buffer.isBuffer(entry.fileName)) {
if (this._zipFileNameEncoding === 'utf8') {
entry.fileName = entry.fileName.toString();
} else {
if (!iconv) {
iconv = require('iconv-lite');
.on('entry', entry => {
const mode = modeFromEntry(entry);
// fileName is buffer by default because decodeStrings = false
if (Buffer.isBuffer(entry.fileName)) {
if (this._zipFileNameEncoding === 'utf8') {
entry.fileName = entry.fileName.toString();
} else {
if (!iconv) {
iconv = require('iconv-lite');
}
entry.fileName = iconv.decode(entry.fileName, this._zipFileNameEncoding);
}
entry.fileName = iconv.decode(entry.fileName, this._zipFileNameEncoding);
}
}
// directory file names end with '/'
const type = /\/$/.test(entry.fileName) ? 'directory' : 'file';
const name = entry.fileName = this[STRIP_NAME](entry.fileName, type);
// directory file names end with '/'
const type = /\/$/.test(entry.fileName) ? 'directory' : 'file';
const name = entry.fileName = this[STRIP_NAME](entry.fileName, type);
const header = { name, type, yauzl: entry, mode };
const header = { name, type, yauzl: entry, mode };
if (type === 'file') {
zipFile.openReadStream(entry, (err, readStream) => {
if (err) return this.emit('error', err);
this.emit('entry', header, readStream, next);
});
} else { // directory
const placeholder = new stream.Readable({ read() {} });
this.emit('entry', header, placeholder, next);
setImmediate(() => placeholder.emit('end'));
}
})
.on('end', () => this.emit('finish'))
.on('error', err => this.emit('error', err));
if (type === 'file') {
zipFile.openReadStream(entry, (err, readStream) => {
if (err) return this.emit('error', err);
this.emit('entry', header, readStream, next);
});
} else { // directory
const placeholder = new stream.Readable({ read() {} });
this.emit('entry', header, placeholder, next);
setImmediate(() => placeholder.emit('end'));
}
})
.on('end', () => this.emit('finish'))
.on('error', err => this.emit('error', err));

@@ -124,0 +124,0 @@ function next() {

{
"name": "compressing",
"version": "1.9.1",
"version": "1.10.0",
"description": "Everything you need for compressing and uncompressing",

@@ -9,4 +9,4 @@ "main": "index.js",

"ts-test": "tsc -p ./test/fixtures/types/tsconfig.json",
"test": "egg-bin test --espower=false --full-trace && npm run ts-test",
"cov": "egg-bin cov --espower=false",
"test": "egg-bin test --ts false && npm run ts-test",
"cov": "egg-bin cov --ts false",
"lint-fix": "eslint . --fix",

@@ -54,13 +54,12 @@ "lint": "eslint .",

"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.9",
"@types/mocha": "10",
"@types/node": "20",
"dir-compare": "^1.3.0",
"egg-bin": "4",
"eslint": "^3.10.2",
"eslint-config-egg": "^3.2.0",
"git-contributor": "^1.1.0",
"egg-bin": "6",
"eslint": "8",
"eslint-config-egg": "12",
"git-contributor": "2",
"mm": "^2.0.0",
"mz-modules": "^2.1.0",
"rimraf": "^2.6.2",
"typescript": "^3.1.6",
"typescript": "5",
"uuid": "^3.0.1"

@@ -67,0 +66,0 @@ },

@@ -371,8 +371,9 @@ # compressing

|[<img src="https://avatars.githubusercontent.com/u/456108?v=4" width="100px;"/><br/><sub><b>shaoshuai0102</b></sub>](https://github.com/shaoshuai0102)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/9692408?v=4" width="100px;"/><br/><sub><b>DiamondYuan</b></sub>](https://github.com/DiamondYuan)<br/>|[<img src="https://avatars.githubusercontent.com/u/13938334?v=4" width="100px;"/><br/><sub><b>bytemain</b></sub>](https://github.com/bytemain)<br/>|[<img src="https://avatars.githubusercontent.com/u/8382136?v=4" width="100px;"/><br/><sub><b>Ryqsky</b></sub>](https://github.com/Ryqsky)<br/>|
|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/456108?v=4" width="100px;"/><br/><sub><b>shaoshuai0102</b></sub>](https://github.com/shaoshuai0102)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/9692408?v=4" width="100px;"/><br/><sub><b>DiamondYuan</b></sub>](https://github.com/DiamondYuan)<br/>|[<img src="https://avatars.githubusercontent.com/u/101238421?v=4" width="100px;"/><br/><sub><b>acyza</b></sub>](https://github.com/acyza)<br/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
[<img src="https://avatars.githubusercontent.com/u/47357585?v=4" width="100px;"/><br/><sub><b>songhn233</b></sub>](https://github.com/songhn233)<br/>|[<img src="https://avatars.githubusercontent.com/u/9857273?v=4" width="100px;"/><br/><sub><b>ShadyZOZ</b></sub>](https://github.com/ShadyZOZ)<br/>
|[<img src="https://avatars.githubusercontent.com/u/13938334?v=4" width="100px;"/><br/><sub><b>bytemain</b></sub>](https://github.com/bytemain)<br/>|[<img src="https://avatars.githubusercontent.com/u/20432815?v=4" width="100px;"/><br/><sub><b>rickyes</b></sub>](https://github.com/rickyes)<br/>|[<img src="https://avatars.githubusercontent.com/u/8382136?v=4" width="100px;"/><br/><sub><b>Ryqsky</b></sub>](https://github.com/Ryqsky)<br/>|[<img src="https://avatars.githubusercontent.com/u/47357585?v=4" width="100px;"/><br/><sub><b>songhn233</b></sub>](https://github.com/songhn233)<br/>|[<img src="https://avatars.githubusercontent.com/u/160386?v=4" width="100px;"/><br/><sub><b>Infiltrator</b></sub>](https://github.com/Infiltrator)<br/>|[<img src="https://avatars.githubusercontent.com/u/13861843?v=4" width="100px;"/><br/><sub><b>ZeekoZhu</b></sub>](https://github.com/ZeekoZhu)<br/>|
[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/59508678?v=4" width="100px;"/><br/><sub><b>okaponta</b></sub>](https://github.com/okaponta)<br/>|[<img src="https://avatars.githubusercontent.com/u/9857273?v=4" width="100px;"/><br/><sub><b>ShadyZOZ</b></sub>](https://github.com/ShadyZOZ)<br/>
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Mon Jul 11 2022 08:28:25 GMT+0800`.
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Aug 03 2023 01:39:37 GMT+0800`.
<!-- GITCONTRIBUTOR_END -->
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