mirror of
https://github.com/denoland/deno.git
synced 2024-10-31 09:14:20 -04:00
00e63306cb
Also enables WPT for FileReader.
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
/// <reference no-default-lib="true" />
|
|
/// <reference lib="esnext" />
|
|
|
|
type BlobPart = BufferSource | Blob | string;
|
|
|
|
interface BlobPropertyBag {
|
|
type?: string;
|
|
endings?: "transparent" | "native";
|
|
}
|
|
|
|
/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
|
|
declare class Blob {
|
|
constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
|
|
|
|
readonly size: number;
|
|
readonly type: string;
|
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
stream(): ReadableStream<Uint8Array>;
|
|
text(): Promise<string>;
|
|
}
|
|
|
|
interface FilePropertyBag extends BlobPropertyBag {
|
|
lastModified?: number;
|
|
}
|
|
|
|
/** Provides information about files and allows JavaScript in a web page to
|
|
* access their content. */
|
|
declare class File extends Blob {
|
|
constructor(
|
|
fileBits: BlobPart[],
|
|
fileName: string,
|
|
options?: FilePropertyBag,
|
|
);
|
|
|
|
readonly lastModified: number;
|
|
readonly name: string;
|
|
}
|