Skip to content

@lancedb/lancedb • Docs


@lancedb/lancedb / BlobFile

Class: BlobFile

A lazy handle to blob bytes. Create one with Table.fetchBlobFiles.

Methods

close()

close(): Promise<void>

Releases the handle. Reads after close() fail. Calling it again does nothing.

Returns

Promise<void>


isClosed()

isClosed(): boolean

Returns true after BlobFile.close.

Returns

boolean


read()

read(maxBytes?, options?): Promise<Buffer>

Reads from the cursor and advances the cursor.

Reads to the end when maxBytes is omitted, or at most maxBytes bytes otherwise. Returns an empty buffer at the end of the blob. BlobFile.readRange does not move the cursor.

Parameters

Returns

Promise<Buffer>


readRange()

readRange(
   start,
   end,
   options?): Promise<Buffer>

Reads the half-open byte range [start, end).

Fails when end is past the blob size. Does not move the cursor.

Parameters

Returns

Promise<Buffer>


readRanges()

readRanges(ranges, options?): Promise<Buffer[]>

Reads several half-open byte ranges. Returns one buffer per range, in the order given.

Fails when any end is past the blob size. Does not move the cursor.

Parameters

Returns

Promise<Buffer[]>


seek()

seek(position): Promise<void>

Moves the cursor to position, in bytes from the start of the blob.

Parameters

  • position: bigint

Returns

Promise<void>


size()

size(): bigint

Returns the blob size in bytes.

Returns

bigint


tell()

tell(): Promise<bigint>

Returns the cursor position in bytes.

Returns

Promise<bigint>