@xhmikosr/downloader 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import defaults from 'defaults';
|
|
|
9
9
|
import extName from 'ext-name';
|
|
10
10
|
import {fileTypeFromBuffer} from 'file-type';
|
|
11
11
|
import filenamify from 'filenamify';
|
|
12
|
-
import getStream from 'get-stream';
|
|
12
|
+
import getStream, {getStreamAsBuffer} from 'get-stream';
|
|
13
13
|
import got from 'got';
|
|
14
14
|
|
|
15
15
|
const defaultGotOptions = {
|
|
@@ -80,8 +80,8 @@ const download = (uri, output, options) => {
|
|
|
80
80
|
|
|
81
81
|
const promise = filterEvents(stream, 'response')
|
|
82
82
|
.then(response => {
|
|
83
|
-
const
|
|
84
|
-
return Promise.all([
|
|
83
|
+
const streamData = options.got.responseType === 'buffer' ? getStreamAsBuffer(stream) : getStream(stream);
|
|
84
|
+
return Promise.all([streamData, response]);
|
|
85
85
|
})
|
|
86
86
|
.then(async ([data, response]) => {
|
|
87
87
|
const hasArchiveData = options.extract && await archiveType(data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhmikosr/downloader",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "Download and extract files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"url"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@xhmikosr/archive-type": "^8.0.
|
|
46
|
-
"@xhmikosr/decompress": "^11.0
|
|
45
|
+
"@xhmikosr/archive-type": "^8.0.1",
|
|
46
|
+
"@xhmikosr/decompress": "^11.1.0",
|
|
47
47
|
"content-disposition": "^1.0.1",
|
|
48
48
|
"defaults": "^2.0.2",
|
|
49
49
|
"ext-name": "^5.0.0",
|
|
50
50
|
"file-type": "^21.3.0",
|
|
51
51
|
"filenamify": "^7.0.1",
|
|
52
|
-
"get-stream": "^
|
|
52
|
+
"get-stream": "^9.0.1",
|
|
53
53
|
"got": "^14.6.6"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@xhmikosr/decompress-unzip": "^8.
|
|
57
|
-
"ava": "^
|
|
58
|
-
"c8": "^
|
|
56
|
+
"@xhmikosr/decompress-unzip": "^8.1.0",
|
|
57
|
+
"ava": "^7.0.0",
|
|
58
|
+
"c8": "^11.0.0",
|
|
59
59
|
"is-zip": "^1.0.0",
|
|
60
60
|
"nock": "^14.0.11",
|
|
61
61
|
"xo": "^1.2.3"
|