Skip to content

pool | @vltpkg/tar

References

isResponseOK

Re-exports isResponseOK

ResponseError

Re-exports ResponseError

ResponseOK

Re-exports ResponseOK

Worker

Re-exports Worker

Classes

Pool

Automatically expanding/contracting set of workers to maximize parallelism of unpack operations up to 1 less than the number of CPUs (or 1).

pool.unpack(tarData, target) will perform the unpack operation synchronously, in one of these workers, and returns a promise when the worker has confirmed completion of the task.

Constructors

new Pool()
new Pool(): Pool
Returns

Pool

Properties

jobs
jobs: number

Number of workers to emplly. Defaults to 1 less than the number of CPUs, or 1.

Defined in

pool.ts:27

pending
pending: Map<number, UnpackRequest>

Requests that have been assigned to a worker, but have not yet been confirmed completed.

Defined in

pool.ts:40

queue
queue: UnpackRequest[] = [];

Queue of requests awaiting an available worker

Defined in

pool.ts:35

workers
workers: Set<Worker>

Set of currently active worker threads

Defined in

pool.ts:31

Methods

unpack()
unpack(tarData, target): Promise<void>

Provide the tardata to be unpacked, and the location where it’s to be placed. Will create a new worker up to the jobs value, and then start pushing in the queue for workers to pick up as they become available.

Returned promise resolves when the provided tarball has been extracted.

Parameters

tarData: Buffer

target: string

Returns

Promise<void>

Defined in

pool.ts:85