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.

Example

const ctx = screen.getContext('2d');
const buf = await file.arrayBuffer();
const img = new Image();
img.onload = () => {
ctx.drawImage(img, 0, 0);
};
img.src = URL.createObjectURL(new Blob([buf]));

Hierarchy

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.

Note

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

    • Optional start: number

      The start byte index.

    • Optional end: number

      The end byte index.

    • Optional type: 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>

    Example

    const ctx = screen.getContext('2d');
    const buf = await file.thumbnail();
    const img = new Image();
    img.onload = () => {
    ctx.drawImage(img, 0, 0);
    };
    img.src = URL.createObjectURL(new Blob([buf]));

Generated using TypeDoc