From 00e63306cbcc295a87ba662f9f63311a3c6c49ce Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 6 Apr 2021 12:55:05 +0200 Subject: refactor: add deno_file op crate (#10019) Also enables WPT for FileReader. --- op_crates/file/lib.deno_file.d.ts | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 op_crates/file/lib.deno_file.d.ts (limited to 'op_crates/file/lib.deno_file.d.ts') diff --git a/op_crates/file/lib.deno_file.d.ts b/op_crates/file/lib.deno_file.d.ts new file mode 100644 index 000000000..a907c3f50 --- /dev/null +++ b/op_crates/file/lib.deno_file.d.ts @@ -0,0 +1,40 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +/// +/// + +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; + slice(start?: number, end?: number, contentType?: string): Blob; + stream(): ReadableStream; + text(): Promise; +} + +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; +} -- cgit v1.2.3