forked from sindresorhus/file-type
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.d.ts
29 lines (23 loc) · 738 Bytes
/
browser.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type {FileTypeResult} from './core.js';
/**
Detect the file type of a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
@example
```
import {fileTypeFromStream} from 'file-type';
const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';
const response = await fetch(url);
const fileType = await fileTypeFromStream(response.body);
console.log(fileType);
//=> {ext: 'jpg', mime: 'image/jpeg'}
```
*/
export declare function fileTypeFromStream(stream: ReadableStream): Promise<FileTypeResult | undefined>;
export {
fileTypeFromBuffer,
fileTypeFromBlob,
supportedExtensions,
supportedMimeTypes,
type FileTypeResult,
type FileExtension,
type MimeType,
} from './core.js';