Spec-Zone.ru › Deno 2

File

File and data manipulation tools. Handle files, read data and work with binary content.

Eg File, Blob


interface Blob

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.

Properties

size: number
readonly
type: string
readonly

Methods

arrayBuffer(): Promise<ArrayBuffer>
bytes(): Promise<Uint8Array<ArrayBuffer>>
slice(
start?: number,
end?: number,
contentType?: string,
): Blob
stream(): ReadableStream<Uint8Array<ArrayBuffer>>
text(): Promise<string>
textStream(): ReadableStream<string>

Returns a ReadableStream<string> that streams the blob's data decoded as UTF-8 text.

variable Blob

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.

Properties

prototype: Blob
readonly

interface BlobPropertyBag

Properties

type: string
optional
endings: EndingType
optional

interface File

extends Blob

Provides information about files and allows JavaScript in a web page to access their content.

Properties

lastModified: number
readonly
name: string
readonly
webkitRelativePath: string
readonly

variable File

Provides information about files and allows JavaScript in a web page to access their content.

Properties

prototype: File
readonly

interface FilePropertyBag

extends BlobPropertyBag

Properties

lastModified: number
optional

interface FileReader

extends EventTarget

Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read.

Properties

error: DOMException | null
readonly
onabort: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
onerror: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
onload: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
onloadend: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
onloadstart: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
onprogress: ((
this: FileReader,
ev: ProgressEvent<FileReader>,
) => any) | null
readyState:
FileReader.EMPTY
| FileReader.LOADING
| FileReader.DONE
readonly
result:
string
| ArrayBuffer
| null
readonly
EMPTY: 0
readonly
LOADING: 1
readonly
DONE: 2
readonly

Methods

abort(): void
readAsArrayBuffer(blob: Blob): void
readAsBinaryString(blob: Blob): void
deprecated
readAsDataURL(blob: Blob): void
readAsText(
blob: Blob,
encoding?: string,
): void
addEventListener<K extends keyof FileReaderEventMap>(
type: K,
listener: (
this: FileReader,
ev: FileReaderEventMap[K],
) => any
,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof FileReaderEventMap>(
type: K,
listener: (
this: FileReader,
ev: FileReaderEventMap[K],
) => any
,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void

variable FileReader

The constructor object for FileReader, used to create a reader that asynchronously reads the contents of a Blob or File into memory.

Properties

prototype: FileReader
readonly
EMPTY: 0
readonly
LOADING: 1
readonly
DONE: 2
readonly

interface FileReaderEventMap

Properties

abort: ProgressEvent<FileReader>
error: ProgressEvent<FileReader>
load: ProgressEvent<FileReader>
loadend: ProgressEvent<FileReader>
loadstart: ProgressEvent<FileReader>
progress: ProgressEvent<FileReader>

type alias BlobPart

Definition

BufferSource
| Blob
| string

type alias EndingType

Definition

"transparent" | "native"

© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/web/file

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API