A File provides information about files.

v19.2.0, v18.13.0

Hierarchy (View Summary)

Constructors

Properties

lastModified: number

The last modified date of the File.

v19.2.0, v18.13.0

name: string

The name of the File.

v19.2.0, v18.13.0

size: number

The total size of the Blob in bytes.

v15.7.0, v14.18.0

type: string

The content-type of the Blob.

v15.7.0, v14.18.0

Methods

  • Returns a promise that fulfills with an ArrayBuffer containing a copy of the Blob data.

    Returns Promise<ArrayBuffer>

    v15.7.0, v14.18.0

  • The blob.bytes() method returns the byte of the Blob object as a Promise<Uint8Array>.

    const blob = new Blob(['hello']);
    blob.bytes().then((bytes) => {
    console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
    });

    Returns Promise<Uint8Array<ArrayBufferLike>>

  • Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered.

    Parameters

    • Optionalstart: number

      The starting index.

    • Optionalend: number

      The ending index.

    • Optionaltype: string

      The content-type for the new Blob

    Returns Blob

    v15.7.0, v14.18.0

  • Returns a new ReadableStream that allows the content of the Blob to be read.

    Returns ReadableStream<any>

    v16.7.0

  • Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string.

    Returns Promise<string>

    v15.7.0, v14.18.0