@xhmikosr/downloader 16.0.1 → 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.
Files changed (2) hide show
  1. package/index.js +3 -3
  2. package/package.json +6 -6
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 encoding = options.got.responseType === 'buffer' ? 'buffer' : options.got.encoding;
84
- return Promise.all([getStream(stream, {encoding}), response]);
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.0.1",
3
+ "version": "16.1.0",
4
4
  "description": "Download and extract files",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,19 +43,19 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "@xhmikosr/archive-type": "^8.0.1",
46
- "@xhmikosr/decompress": "^11.0.2",
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": "^6.0.1",
52
+ "get-stream": "^9.0.1",
53
53
  "got": "^14.6.6"
54
54
  },
55
55
  "devDependencies": {
56
- "@xhmikosr/decompress-unzip": "^8.0.0",
57
- "ava": "^6.4.1",
58
- "c8": "^10.1.3",
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"