Lens Scripting API

    Class BlobWearable Only

    Represents a blob, which is a file-like object of immutable, raw data. Can be read as text or binary data. Currently the binary data is only supported as Uint8Array.

    socket.onmessage = async (event) => {
    if (event.data instanceof Blob) {
    // Binary frame, can be retrieved as either Uint8Array or string
    let bytes = await event.data.bytes();
    let text = await event.data.text();

    print("Received binary message, printing as text: " + text);
    }
    });

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    size: number

    The size of the blob's data in bytes.

    Methods

    • Returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

      Returns any

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.

      Returns any

    MMNEPVFCICPMFPCPTTAAATR