@contentauth/c2pa-js
    Preparing search index...

    Exposes methods for reading C2PA data out of an asset.

    const reader = await c2pa.reader.fromBlob(blob.type, blob);

    const activeManifest = await reader.activeManfiest();
    interface Reader {
        activeLabel: () => Promise<null | string>;
        activeManifest: () => Promise<Manifest>;
        free: () => Promise<void>;
        json: () => Promise<any>;
        manifestStore: () => Promise<ManifestStore>;
        resourceToBytes: (uri: string) => Promise<Uint8Array<ArrayBufferLike>>;
    }
    Index

    Properties

    activeLabel: () => Promise<null | string>

    Type Declaration

      • (): Promise<null | string>
      • Returns Promise<null | string>

        The label of the active manifest.

    activeManifest: () => Promise<Manifest>

    Type Declaration

    free: () => Promise<void>

    Dispose of this Reader, freeing the memory it occupied and preventing further use. Call this whenever the Reader is no longer needed.

    json: () => Promise<any>

    Type Declaration

      • (): Promise<any>
      • Returns Promise<any>

        The asset's full ManifestStore.

    Use manifestStore instead.

    manifestStore: () => Promise<ManifestStore>

    Type Declaration

    resourceToBytes: (uri: string) => Promise<Uint8Array<ArrayBufferLike>>

    Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.

    Type Declaration

      • (uri: string): Promise<Uint8Array<ArrayBufferLike>>
      • Parameters

        • uri: string

          URI of the binary object to resolve.

        Returns Promise<Uint8Array<ArrayBufferLike>>

        A Uint8Array of the resource's bytes.

    const reader = await c2pa.reader.fromBlob(blob.type, blob);

    const activeManifest = await reader.activeManifest();

    const thumbnailBuffer = await reader.resourceToBytes(activeManifest.thumbnail!.identifier);