|
1 | 1 | import { createHmac, randomUUID } from 'crypto' |
2 | | -import got, { RetryOptions, Headers, OptionsOfJSONResponseBody, Delays, RequestError, HTTPError } from 'got' |
| 2 | +import got, { |
| 3 | + RetryOptions, |
| 4 | + Headers, |
| 5 | + OptionsOfJSONResponseBody, |
| 6 | + Delays, |
| 7 | + RequestError, |
| 8 | + HTTPError, |
| 9 | +} from 'got' |
3 | 10 | import FormData from 'form-data' |
4 | 11 | import { constants, createReadStream } from 'fs' |
5 | 12 | import { access } from 'fs/promises' |
6 | 13 | import debug from 'debug' |
7 | | -import intoStream from 'into-stream' |
8 | | -import isStream from 'is-stream' |
| 14 | +import intoStream, { Input as IntoStreamInput } from 'into-stream' |
| 15 | +import { isReadableStream, isStream } from 'is-stream' |
9 | 16 | import * as assert from 'assert' |
10 | 17 | import pMap from 'p-map' |
11 | 18 | import type { Readable } from 'stream' |
@@ -72,7 +79,7 @@ export interface CreateAssemblyOptions { |
72 | 79 | [name: string]: string |
73 | 80 | } |
74 | 81 | uploads?: { |
75 | | - [name: string]: Readable | intoStream.Input |
| 82 | + [name: string]: Readable | IntoStreamInput |
76 | 83 | } |
77 | 84 | waitForCompletion?: boolean |
78 | 85 | chunkSize?: number |
@@ -247,13 +254,13 @@ export class Transloadit { |
247 | 254 | // Convert uploads to streams |
248 | 255 | const streamsMap = Object.fromEntries( |
249 | 256 | Object.entries(uploads).map(([label, value]) => { |
250 | | - const isReadable = isStream.readable(value) |
| 257 | + const isReadable = isReadableStream(value) |
251 | 258 | if (!isReadable && isStream(value)) { |
252 | 259 | // https://github.com/transloadit/node-sdk/issues/92 |
253 | 260 | throw new Error(`Upload named "${label}" is not a Readable stream`) |
254 | 261 | } |
255 | 262 |
|
256 | | - return [label, isStream.readable(value) ? value : intoStream(value)] |
| 263 | + return [label, isReadableStream(value) ? value : intoStream(value)] |
257 | 264 | }) |
258 | 265 | ) |
259 | 266 |
|
|
0 commit comments