mirror of
https://github.com/directus/directus.git
synced 2026-02-19 10:14:33 -05:00
* Add new packages * Update docs * Update linked packages * Setup file pointers * Don't require getStream to be async * List credits * Load azure in storage * Fix typo in docs * Fix another typo * Remove not about raising an issue
21 lines
591 B
TypeScript
21 lines
591 B
TypeScript
import { promisify } from 'util';
|
|
import { pipeline as nodePipeline } from 'stream';
|
|
|
|
/**
|
|
* Returns a boolean indication if stream param
|
|
* is a readable stream or not.
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export function isReadableStream(stream: any): stream is NodeJS.ReadableStream {
|
|
return (
|
|
stream !== null &&
|
|
typeof stream === 'object' &&
|
|
typeof stream.pipe === 'function' &&
|
|
typeof stream._read === 'function' &&
|
|
typeof stream._readableState === 'object' &&
|
|
stream.readable !== false
|
|
);
|
|
}
|
|
|
|
export const pipeline = promisify(nodePipeline);
|