@xhmikosr/downloader
Advanced tools
Comparing version 9.0.0 to 10.0.0
10
index.js
@@ -11,3 +11,3 @@ import {promises as fs} from 'node:fs'; | ||
import {pEvent} from 'p-event'; | ||
import fileType from 'file-type'; | ||
import {fileTypeFromBuffer} from 'file-type'; | ||
import extName from 'ext-name'; | ||
@@ -33,3 +33,3 @@ | ||
const getFilename = (res, data) => { | ||
const getFilename = async (res, data) => { | ||
const header = res.headers['content-disposition']; | ||
@@ -48,3 +48,3 @@ | ||
if (!path.extname(filename)) { | ||
const ext = (fileType(data) || {}).ext || getExtFromMime(res); | ||
const ext = (await fileTypeFromBuffer(data) || {}).ext || getExtFromMime(res); | ||
@@ -78,3 +78,3 @@ if (ext) { | ||
return Promise.all([getStream(stream, {encoding}), res]); | ||
}).then(result => { | ||
}).then(async result => { | ||
const [data, res] = result; | ||
@@ -86,3 +86,3 @@ | ||
const filename = options.filename || filenamify(getFilename(res, data)); | ||
const filename = options.filename || filenamify(await getFilename(res, data)); | ||
const outputFilepath = path.join(output, filename); | ||
@@ -89,0 +89,0 @@ |
{ | ||
"name": "@xhmikosr/downloader", | ||
"version": "9.0.0", | ||
"version": "10.0.0", | ||
"description": "Download and extract files", | ||
@@ -13,12 +13,14 @@ "license": "MIT", | ||
"name": "Kevin Mårtensson", | ||
"url": "github.com/kevva" | ||
"url": "https://github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": "^12.20.0 || ^14.14.0 || >=16.0.0" | ||
"node": "^14.14.0 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
"ava": "ava", | ||
"lint": "xo", | ||
"xo": "xo", | ||
"fix": "xo --fix", | ||
"test": "npm run xo && npm run ava", | ||
"test-ci": "npm run xo && c8 ava" | ||
"test-ci": "c8 ava" | ||
}, | ||
@@ -42,2 +44,3 @@ "main": "index.js", | ||
"reporter": [ | ||
"html", | ||
"lcovonly", | ||
@@ -48,20 +51,20 @@ "text" | ||
"dependencies": { | ||
"@xhmikosr/decompress": "^5.0.0", | ||
"@xhmikosr/decompress": "^6.0.0", | ||
"archive-type": "^4.0.0", | ||
"content-disposition": "^0.5.4", | ||
"ext-name": "^5.0.0", | ||
"file-type": "^12.4.2", | ||
"file-type": "^18.4.0", | ||
"filenamify": "^5.1.1", | ||
"get-stream": "^6.0.1", | ||
"got": "^11.8.5", | ||
"got": "^11.8.6", | ||
"p-event": "^5.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^4.3.0", | ||
"c8": "^7.11.3", | ||
"ava": "^5.3.0", | ||
"c8": "^7.13.0", | ||
"is-zip": "^1.0.0", | ||
"nock": "^13.2.6", | ||
"nock": "^13.3.1", | ||
"path-exists": "^5.0.0", | ||
"random-buffer": "^0.1.0", | ||
"xo": "^0.49.0" | ||
"xo": "^0.54.2" | ||
}, | ||
@@ -68,0 +71,0 @@ "xo": { |
@@ -1,2 +0,2 @@ | ||
# download [![CI](https://github.com/XhmikosR/download/actions/workflows/ci.yml/badge.svg)](https://github.com/XhmikosR/download/actions/workflows/ci.yml) | ||
# download [![CI](https://github.com/XhmikosR/download/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/XhmikosR/download/actions/workflows/ci.yml) | ||
@@ -3,0 +3,0 @@ > Download and extract files |
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
6596
+ Added@tokenizer/token@0.3.0(transitive)
+ Added@xhmikosr/decompress@6.0.0(transitive)
+ Addedfile-type@18.7.0(transitive)
+ Addedpeek-readable@5.2.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedreadable-web-to-node-stream@3.0.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrtok3@7.1.1(transitive)
+ Addedtoken-types@5.0.1(transitive)
- Removed@xhmikosr/decompress@5.0.0(transitive)
- Removedfile-type@12.4.2(transitive)
- Removedpify@5.0.0(transitive)
Updated@xhmikosr/decompress@^6.0.0
Updatedfile-type@^18.4.0
Updatedgot@^11.8.6