diff --git a/index.d.ts b/index.d.ts index 39e6de9b..82d854cd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -43,15 +43,17 @@ The file type is detected by checking the [magic number](https://en.wikipedia.or export function fileTypeFromFile(filePath: string, options?: {customDetectors?: Iterable}): Promise; /** -Detect the file type of a [Web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream). +Detect the file type of a [web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream). + If the engine is Node.js, this may also be a [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). -Direct support for Node.js streams will be dropped in the future, when Node.js streams can be converted to Web streams (see [toWeb()](https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options)). + +Direct support for Node.js streams will be dropped in the future, when Node.js streams can be converted to Web streams (see [`toWeb()`](https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options)). The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. -@param stream A [Web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) or [Node.js readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) streaming a file to examine. +@param stream - A [web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) or [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) streaming a file to examine. @returns A `Promise` for an object with the detected file type, or `undefined` when there is no match. - */ +*/ export function fileTypeFromStream(stream: AnyWebReadableStream | NodeReadableStream): Promise; /**