Class BlobStore

Hierarchy

  • TypedEmitter
    • BlobStore

Constructors

  • Parameters

    • options: {
          coreManager: CoreManager;
          downloadFilter: null | BlobFilter;
      }
      • coreManager: CoreManager
      • downloadFilter: null | BlobFilter

        Filter blob types and/or variants to download. Set to null to download all blobs.

    Returns BlobStore

Accessors

  • get writerDriveId(): string
  • Returns string

Methods

  • Parameters

    • blobId: BlobId
    • Optionaloptions: {
          diff: undefined | boolean;
      } = {}
      • diff: undefined | boolean

        Enable to return an object with a block property with number of bytes removed

    Returns Promise<null | {
        blocks: number;
    }>

  • Returns void

  • This is a low-level method to create a stream of entries from all drives. It includes entries for unknown blob types and variants.

    Parameters

    • opts: {
          filter: undefined | null | GenericBlobFilter;
          live: undefined | boolean;
      } = {}
      • filter: undefined | null | GenericBlobFilter

        Filter blob types and/or variants in returned entries. Filter is { [BlobType]: BlobVariants[] }.

      • live: undefined | boolean

        Set to true to get a live stream of entries

    Returns BlobStoreEntriesStream

  • Parameters

    • blobId: BlobId
    • Optionaloptions: {
          timeout: undefined | number;
          wait: undefined | boolean;
      } = ...
      • timeout: undefined | number

        Optional timeout to wait for a blob to download

      • wait: undefined | boolean

        Set to true to wait for a blob to download, otherwise will throw if blob is not available locally

    Returns Readable

  • Optimization for creating the blobs read stream when you have previously read the entry from Hyperdrive using drive.entry

    Parameters

    • driveId: string

      Hyperdrive drive discovery id

    • entry: HyperdriveEntry

      Hyperdrive entry

    • Optionaloptions: {
          wait: undefined | boolean;
      } = ...
      • wait: undefined | boolean

        Set to true to wait for a blob to download, otherwise will throw if blob is not available locally

    Returns Promise<Readable>

  • Parameters

    • blobId: Omit<BlobId, "driveId">
    • Optionaloptions: {
          metadata: undefined | JsonObject;
      }
      • metadata: undefined | JsonObject

        Metadata to store with the blob

    Returns Writable<any, any, any, false, true, WritableEvents<any>> & {
        driveId: string;
    }

  • Parameters

    • blobId: BlobId
    • Optionaloptions: {
          follow: undefined | boolean;
          timeout: undefined;
          wait: undefined | false;
      } = ...
      • follow: undefined | boolean

        Set to true to follow symlinks (16 max or throws an error)

      • timeout: undefined

        Optional timeout to wait for a blob to download

      • wait: undefined | false

        Set to true to wait for a blob to download, otherwise will throw if blob is not available locally

    Returns Promise<null | HyperdriveEntry>

  • Parameters

    • blobId: BlobId
    • opts: {
          timeout: undefined;
          wait: undefined | false;
      } = {}
      • timeout: undefined

        Optional timeout to wait for a blob to download

      • wait: undefined | false

        Set to true to wait for a blob to download, otherwise will throw if blob is not available locally

    Returns Promise<Uint8Array>

  • Parameters

    • driveId: string

      Hyperdrive drive id

    • entry: HyperdriveEntry

      Hyperdrive entry

    • Optionalopts: {
          length: undefined | number;
      } = {}
      • length: undefined | number

    Returns Promise<null | Buffer>

  • Parameters

    • blobId: Omit<BlobId, "driveId">
    • blob: Buffer
    • Optionaloptions: {
          metadata: undefined | JsonObject;
      }
      • metadata: undefined | JsonObject

        Metadata to store with the blob

    Returns Promise<string>

    discovery key as hex string of hyperdrive where blob is stored

  • Set the filter for downloading blobs.

    Parameters

    • filter: null | BlobFilter

      Filter blob types and/or variants to download. Filter is { [BlobType]: BlobVariants[] }. At least one blob variant must be specified for each blob type.

    Returns void