Spaces:
Runtime error
Runtime error
File size: 2,533 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
import { Blob, BlobParts as FileBits, BlobPropertyBag } from "./Blob";
export interface FileLike {
/**
* Name of the file referenced by the File object.
*/
readonly name: string;
/**
* Size of the file parts in bytes
*/
readonly size: number;
/**
* Returns the media type ([`MIME`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)) of the file represented by a `File` object.
*/
readonly type: string;
/**
* The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
*/
readonly lastModified: number;
[Symbol.toStringTag]: string;
/**
* Returns a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) which upon reading returns the data contained within the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
*/
stream(): AsyncIterable<Uint8Array>;
}
export interface FilePropertyBag extends BlobPropertyBag {
/**
* The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
*/
lastModified?: number;
}
/**
* @deprecated Use FilePropertyBag instead.
*/
export declare type FileOptions = FilePropertyBag;
/**
* The **File** interface provides information about files and allows JavaScript to access their content.
*/
export declare class File extends Blob implements FileLike {
#private;
static [Symbol.hasInstance](value: unknown): value is File;
/**
* Creates a new File instance.
*
* @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
* @param name The name of the file.
* @param options An options object containing optional attributes for the file.
*/
constructor(fileBits: FileBits, name: string, options?: FilePropertyBag);
get name(): string;
get lastModified(): number;
get webkitRelativePath(): string;
get [Symbol.toStringTag](): string;
}
|