Skip to main content

BrowserBufferStore

DBPF.js v1.1.0 • Docs


DBPF.js v1.1.0 / BufferStore / BrowserBufferStore

Class: BrowserBufferStore

A buffer store for browser environments.

Remarks​

This class is designed to work only with Blobs and File objects.

Extends​

  • BaseBufferStore

Constructors​

new BrowserBufferStore()​

new BrowserBufferStore(file, segment_options): BrowserBufferStore

Parameters​

• file: Blob | File

The Blob/File object to read from.

• segment_options: Partial<SegmentOptions> = {}

Returns​

BrowserBufferStore

See​

SegmentOptions

Overrides​

BaseBufferStore.constructor

Defined in​

src/BufferStore.ts:379

Properties​

_blob​

private _blob: undefined | Blob | File

The file property for the browser backing store.

Defined in​

src/BufferStore.ts:392


/ _direct​

protected readonly _direct: BufferStoreDirect

The browser implementation of the direct buffer getter for retrieving buffer segments directly from the file system.

See​

BaseBufferStore._direct

Param​

The offset in the buffer to start reading from.

Param​

The length of the buffer to read.

Overrides​

BaseBufferStore._direct

Defined in​

src/BufferStore.ts:435


count​

readonly count: number

The number of segments in the cache.

Inherited from​

BaseBufferStore.count

Defined in​

src/BufferStore.ts:199


length​

readonly length: number

The length of the file in bytes.

Inherited from​

BaseBufferStore.length

Defined in​

src/BufferStore.ts:185


segment / _size​

readonly segment_size: number

The size of each segment in bytes.

Inherited from​

BaseBufferStore.segment_size

Defined in​

src/BufferStore.ts:192

Accessors​

_file​

set protected _file(file): void

The setter for the file property.

See​

BaseBufferStore._file

Parameters​

• file: Blob | File

Overrides​

BaseBufferStore._file

Defined in​

src/BufferStore.ts:397

Methods​

_read()​

protected _read(index): Promise<BufferStoreEntry>

The browser implementation of the cache fallthrough method for retrieving non-cached buffer segments.

Parameters​

• index: number

The index of the buffer segment to read from the file system.

Returns​

Promise<BufferStoreEntry>

See​

BaseBufferStore._read

Overrides​

BaseBufferStore._read

Defined in​

src/BufferStore.ts:410


get()​

get(offset, length): BufferReader

Retrieves a buffer by its offset and length and wraps it in a BufferReader.

Parameters​

• offset: number

• length: number

Returns​

BufferReader

Inherited from​

BaseBufferStore.get

Defined in​

src/BufferStore.ts:254