File size: 843 Bytes
51ddcbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 { FileLike } from "../FileLike";
/**
 * Check if given object is `File`.
 *
 * Note that this function will return `false` for Blob, because the FormDataEncoder expects FormData to return File when a value is binary data.
 *
 * @param value an object to test
 *
 * @api public
 *
 * This function will return `true` for FileAPI compatible `File` objects:
 *
 * ```
 * import {isFileLike} from "form-data-encoder"
 *
 * isFileLike(new File(["Content"], "file.txt")) // -> true
 * ```
 *
 * However, if you pass a Node.js `Buffer` or `ReadStream`, it will return `false`:
 *
 * ```js
 * import {isFileLike} from "form-data-encoder"
 *
 * isFileLike(Buffer.from("Content")) // -> false
 * isFileLike(fs.createReadStream("path/to/a/file.txt")) // -> false
 * ```
 */
export declare const isFileLike: (value?: unknown) => value is FileLike;