@xhmikosr/decompress-tarbz2
Advanced tools
Comparing version 5.0.0 to 6.0.0
17
index.js
import {Buffer} from 'node:buffer'; | ||
import decompressTar from '@xhmikosr/decompress-tar'; | ||
import fileType from 'file-type'; | ||
import {fileTypeFromBuffer} from 'file-type'; | ||
import {isStream} from 'is-stream'; | ||
@@ -8,10 +8,13 @@ import seekBzip from 'seek-bzip'; | ||
// eslint-disable-next-line import/no-anonymous-default-export | ||
export default () => input => { | ||
const decompressTarBz2 = () => async input => { | ||
if (!Buffer.isBuffer(input) && !isStream(input)) { | ||
return Promise.reject(new TypeError(`Expected a Buffer or Stream, got ${typeof input}`)); | ||
throw new TypeError(`Expected a Buffer or Stream, got ${typeof input}`); | ||
} | ||
if (Buffer.isBuffer(input) && (!fileType(input) || fileType(input).ext !== 'bz2')) { | ||
return Promise.resolve([]); | ||
if (Buffer.isBuffer(input)) { | ||
const type = await fileTypeFromBuffer(input); | ||
if (!type || type.ext !== 'bz2') { | ||
return []; | ||
} | ||
} | ||
@@ -25,1 +28,3 @@ | ||
}; | ||
export default decompressTarBz2; |
{ | ||
"name": "@xhmikosr/decompress-tarbz2", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "decompress tar.bz2 plugin", | ||
@@ -43,4 +43,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@xhmikosr/decompress-tar": "^5.0.0", | ||
"file-type": "^12.4.2", | ||
"@xhmikosr/decompress-tar": "^6.0.1", | ||
"file-type": "^18.5.0", | ||
"is-stream": "^3.0.0", | ||
@@ -51,3 +51,3 @@ "seek-bzip": "^1.0.6", | ||
"devDependencies": { | ||
"ava": "^5.3.0", | ||
"ava": "^4.3.3", | ||
"is-jpg": "^3.0.0", | ||
@@ -54,0 +54,0 @@ "xo": "^0.54.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3687
22
+ Added@tokenizer/token@0.3.0(transitive)
+ Added@xhmikosr/decompress-tar@6.0.1(transitive)
+ Addedfile-type@18.7.0(transitive)
+ Addedpeek-readable@5.3.1(transitive)
+ Addedreadable-web-to-node-stream@3.0.2(transitive)
+ Addedstrtok3@7.1.1(transitive)
+ Addedtoken-types@5.0.1(transitive)
- Removed@xhmikosr/decompress-tar@5.0.0(transitive)
- Removedfile-type@12.4.2(transitive)
Updatedfile-type@^18.5.0