Skip to main content

NodeBufferStore

DBPF.js v1.1.0 • Docs


DBPF.js v1.1.0 / BufferStore / NodeBufferStore

Class: NodeBufferStore

A buffer store for Node.js environments.

Remarks​

This class is designed to work with both Blobs/File objects and file paths.

Extends​

  • BaseBufferStore

Constructors​

new NodeBufferStore()​

new NodeBufferStore(file, segment_options): NodeBufferStore

Parameters​

• file: string | Blob | File

The Blob/File object or file path to read from.

• segment_options: Partial<SegmentOptions> = {}

Returns​

NodeBufferStore

See​

SegmentOptions

Overrides​

BaseBufferStore.constructor

Defined in​

src/BufferStore.ts:270

Properties​

_blob​

private _blob: undefined | Blob | File

The file property for the Node.js backing store, if it is a Blob or File object.

Defined in​

src/BufferStore.ts:281


/ _direct​

protected readonly _direct: BufferStoreDirect

The Node.js 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:339


/ _path​

private _path: undefined | string

The file property for the Node.js backing store, if it is a file path.

Defined in​

src/BufferStore.ts:285


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: string | Blob | File

Overrides​

BaseBufferStore._file

Defined in​

src/BufferStore.ts:290

Methods​

_read()​

protected _read(index): Promise<BufferStoreEntry>

The Node.js 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:310


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