| 1 | export interface FormidableFile { |
| 2 | /** |
| 3 | * The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` |
| 4 | * event), this property says how many bytes of the file have been written to disk yet. |
| 5 | */ |
| 6 | size: number; |
| 7 | |
| 8 | /** |
| 9 | * The path this file is being written to. You can modify this in the `'fileBegin'` event in case |
| 10 | * you are unhappy with the way formidable generates a temporary path for your files. |
| 11 | */ |
| 12 | filepath: string; |
| 13 | |
| 14 | /** |
| 15 | * The name this file had according to the uploading client. |
| 16 | */ |
| 17 | originalFilename: string | null; |
| 18 | |
| 19 | /** |
| 20 | * Calculated based on options provided |
| 21 | */ |
| 22 | newFilename: string; |
| 23 | |
| 24 | /** |
| 25 | * The mime type of this file, according to the uploading client. |
| 26 | */ |
| 27 | mimetype: string | null; |
| 28 | |
| 29 | /** |
| 30 | * A Date object (or `null`) containing the time this file was last written to. Mostly here for |
| 31 | * compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/). |
| 32 | */ |
| 33 | mtime?: Date | null | undefined; |
| 34 | |
| 35 | hashAlgorithm: false | 'sha1' | 'md5' | 'sha256'; |
| 36 | |
| 37 | /** |
| 38 | * If `options.hashAlgorithm` calculation was set, you can read the hex digest out of this var |
| 39 | * (at the end it will be a string). |
| 40 | */ |
| 41 | hash?: string | null; |
| 42 | |
| 43 | /** |
| 44 | * This method returns a JSON-representation of the file, allowing you to JSON.stringify() the |
| 45 | * file which is useful for logging and responding to requests. |
| 46 | * |
| 47 | * @link https://github.com/node-formidable/formidable#filetojson |
| 48 | */ |
| 49 | toJSON(): FileJSON; |
| 50 | |
| 51 | toString(): string; |
| 52 | } |
| 53 | |
| 54 | interface FileJSON |
| 55 | extends Pick<FormidableFile, 'size' | 'filepath' | 'originalFilename' | 'mimetype' | 'hash'> { |
no outgoing calls
no test coverage detected