helia
    Preparing search index...

    Interface Car

    The Car interface provides operations for importing and exporting Car files from Helia's underlying blockstore.

    interface Car {
        export(
            root:
                | CID<unknown, number, number, Version>
                | CID<unknown, number, number, Version>[],
            options?: ExportCarOptions,
        ): AsyncGenerator<Uint8Array<ArrayBufferLike>, void, undefined>;
        import(
            reader: Pick<CarReader, "blocks">,
            options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>,
        ): Promise<void>;
    }
    Index

    Methods

    Methods

    • Returns an AsyncGenerator that yields CAR file bytes.

      Parameters

      Returns AsyncGenerator<Uint8Array<ArrayBufferLike>, void, undefined>

      import { createHelia } from 'helia'
      import { car } from '@helia/car'
      import { CID } from 'multiformats/cid'

      const helia = await createHelia()
      const cid = CID.parse('QmFoo...')

      const c = car(helia)

      for (const buf of c.export(cid)) {
      // store or send `buf` somewhere
      }