archiver-utils
Advanced tools
+8
-15
@@ -10,3 +10,2 @@ /** | ||
| var path = require('path'); | ||
| var nutil = require('util'); | ||
| var lazystream = require('lazystream'); | ||
@@ -22,8 +21,2 @@ var normalizePath = require('normalize-path'); | ||
| function assertPath(path) { | ||
| if (typeof path !== 'string') { | ||
| throw new TypeError('Path must be a string. Received ' + nutils.inspect(path)); | ||
| } | ||
| } | ||
| utils.collectStream = function(source, callback) { | ||
@@ -41,3 +34,3 @@ var collection = []; | ||
| source.on('end', function() { | ||
| var buf = new Buffer(size); | ||
| var buf = Buffer.alloc(size); | ||
| var offset = 0; | ||
@@ -88,10 +81,10 @@ | ||
| if (source === null) { | ||
| return new Buffer(0); | ||
| return Buffer.alloc(0); | ||
| } else if (typeof source === 'string') { | ||
| return new Buffer(source); | ||
| } else if (utils.isStream(source) && !source._readableState) { | ||
| var normalized = new PassThrough(); | ||
| source.pipe(normalized); | ||
| return normalized; | ||
| return Buffer.from(source); | ||
| } else if (utils.isStream(source)) { | ||
| // Always pipe through a PassThrough stream to guarantee pausing the stream if it's already flowing, | ||
| // since it will only be processed in a (distant) future iteration of the event loop, and will lose | ||
| // data if already flowing now. | ||
| return source.pipe(new PassThrough()); | ||
| } | ||
@@ -98,0 +91,0 @@ |
+7
-7
| { | ||
| "name": "archiver-utils", | ||
| "version": "2.1.0", | ||
| "version": "3.0.3", | ||
| "license": "MIT", | ||
@@ -28,3 +28,3 @@ "description": "utility functions for archiver", | ||
| "engines": { | ||
| "node": ">= 6" | ||
| "node": ">= 10" | ||
| }, | ||
@@ -44,9 +44,9 @@ "scripts": { | ||
| "normalize-path": "^3.0.0", | ||
| "readable-stream": "^2.0.0" | ||
| "readable-stream": "^3.6.0" | ||
| }, | ||
| "devDependencies": { | ||
| "chai": "^4.2.0", | ||
| "mkdirp": "^0.5.0", | ||
| "mocha": "^5.0.0", | ||
| "rimraf": "^2.6.3" | ||
| "chai": "4.3.7", | ||
| "mkdirp": "3.0.1", | ||
| "mocha": "9.2.2", | ||
| "rimraf": "3.0.2" | ||
| }, | ||
@@ -53,0 +53,0 @@ "publishConfig": { |
+1
-2
@@ -1,4 +0,3 @@ | ||
| # Archiver Utils [](https://travis-ci.org/archiverjs/archiver-utils) [](https://ci.appveyor.com/project/ctalkington/archiver-utils/branch/master) | ||
| # Archiver Utils | ||
| ## Things of Interest | ||
@@ -5,0 +4,0 @@ - [Changelog](https://github.com/archiverjs/archiver-utils/releases) |
-14
| ## Changelog | ||
| **2.1.0** — <small> July 19, 2019 </small> — [Diff](https://github.com/archiverjs/archiver-utils/compare/2.0.0...2.1.0) | ||
| - other: less lodash (#16) | ||
| - other: update dependencies | ||
| **2.0.0** — <small> August 22, 2018 </small> — [Diff](https://github.com/archiverjs/archiver-utils/compare/1.3.0...2.0.0) | ||
| - breaking: follow node LTS, remove support for versions under 6. | ||
| - other: remove unused lodash dependence (#13) | ||
| - test: now targeting node v10 | ||
| [Release Archive](https://github.com/archiverjs/archiver-utils/releases) |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
12650
-9.12%5
-16.67%311
-1.58%7
-12.5%1
Infinity%+ Added
Updated