@xhmikosr/downloader 16.1.3 → 16.2.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 +2 -2
- package/package.json +1 -2
package/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import events from 'node:events';
|
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import process from 'node:process';
|
|
5
|
+
import {buffer, text} from 'node:stream/consumers';
|
|
5
6
|
import {parse} from 'content-disposition';
|
|
6
7
|
import archiveType from '@xhmikosr/archive-type';
|
|
7
8
|
import decompress from '@xhmikosr/decompress';
|
|
8
9
|
import extName from 'ext-name';
|
|
9
10
|
import {fileTypeFromBuffer} from 'file-type';
|
|
10
11
|
import filenamify from 'filenamify';
|
|
11
|
-
import getStream, {getStreamAsBuffer} from 'get-stream';
|
|
12
12
|
import got from 'got';
|
|
13
13
|
|
|
14
14
|
const defaultGotOptions = {
|
|
@@ -91,7 +91,7 @@ const download = (uri, output, options = {}) => {
|
|
|
91
91
|
|
|
92
92
|
const promise = (async () => {
|
|
93
93
|
const response = await filterEvents(stream, 'response');
|
|
94
|
-
const streamData = options.got.responseType === 'buffer' ?
|
|
94
|
+
const streamData = options.got.responseType === 'buffer' ? buffer(stream) : text(stream);
|
|
95
95
|
const data = await streamData;
|
|
96
96
|
|
|
97
97
|
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.2.0",
|
|
4
4
|
"description": "Download and extract files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"ext-name": "^5.0.0",
|
|
49
49
|
"file-type": "^21.3.4",
|
|
50
50
|
"filenamify": "^7.0.1",
|
|
51
|
-
"get-stream": "^9.0.1",
|
|
52
51
|
"got": "^14.6.6"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|