Files
directus/packages/drive/src/utils.ts
Rijk van Zanten 35830a5dfe Move Flydrive home and implement Azure (#4110)
* 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
2021-02-16 18:33:50 -05:00

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);