Class BlobStore

Constructors

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;
    }>

  • 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<BlobReadStream>

  • 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<any, any, any, true, false, ReadableEvents<any>>

  • Parameters

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

        Metadata to store with the blob

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

  • Download blobs from all drives, optionally filtering particular blob types or blob variants. Download will be 'live' and will continue downloading new data as it becomes available from any replicating drive.

    If no filter is specified, all blobs will be downloaded. If a filter is specified, then only blobs that match the filter will be downloaded.

    Parameters

    • Optionalfilter: 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.

    • options: {
          signal: undefined | AbortSignal;
      } = {}
      • signal: undefined | AbortSignal

        Optional AbortSignal to cancel in-progress download

    Returns LiveDownload

    EventEmitter with .state propery, emits state with new state when it updates

  • 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<Buffer>

  • 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 | {
              mimeType: string;
          };
      }
      • metadata: undefined | {
            mimeType: string;
        }

        Metadata to store with the blob

    Returns Promise<string>

    discovery key as hex string of hyperdrive where blob is stored