Class AlbumFile

Represents a file within a Switch.Album content store, which is either a screenshot (JPEG image) or a screen recording (MP4 movie).

It is a subclass of File, so you can use familiar features like name, lastModified and arrayBuffer(). It also has additional metadata like applicationId to determine which application generated the contents.

const ctx = screen.getContext('2d');
const buf = await file.arrayBuffer();
const img = await createImageBitmap(new Blob([buf]));
ctx.drawImage(img, 0, 0);

Hierarchy (view full)

Constructors

  • Parameters

    • storage: number
    • id: string

    Returns AlbumFile

Properties

applicationId: bigint

The ID of the application which generated the album file.

content: number

The type of content which the album file contains. The value corresponds with the CapsAlbumFileContents enum from @nx.js/constants.

id: number

Unique ID for when there's multiple album files with the same timestamp.

The value is usually 0.

lastModified: number
name: string
storage: number

The storage device which contains the album file. The value corresponds with the CapsAlbumStorage enum from @nx.js/constants.

webkitRelativePath: string

Accessors

  • get size(): number
  • Returns the size of the Blob object, in bytes.

    Returns number

  • get type(): string
  • Returns the MIME type of the Blob object.

    Returns string

Methods

  • Returns a new Blob object containing the data in the specified range of bytes of the source Blob.

    Parameters

    • Optionalstart: number

      The start byte index.

    • Optionalend: number

      The end byte index.

    • Optionaltype: string

      The content type of the new Blob.

    Returns Blob

  • Returns a promise that resolves with a string representation of the Blob object.

    Returns Promise<string>

  • Loads the thumbnail JPEG image for the album file.

    Returns Promise<ArrayBuffer>

    const ctx = screen.getContext('2d');
    const buf = await file.thumbnail();
    const img = await createImageBitmap(new Blob([buf]));
    ctx.drawImage(img, 0, 0);