Skip to content

@vltpkg/tar/pool

Classes

Pool

Defined in: pool.ts:21

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

Defined in: pool.ts:27

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

pending
pending: Map<number, UnpackRequest>

Defined in: pool.ts:40

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

queue
queue: UnpackRequest[] = [];

Defined in: pool.ts:35

Queue of requests awaiting an available worker

workers
workers: Set<Worker>

Defined in: pool.ts:31

Set of currently active worker threads

Methods

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

Defined in: pool.ts:88

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>

References

isResponseOK

Re-exports isResponseOK

ResponseError

Re-exports ResponseError

ResponseOK

Re-exports ResponseOK

Worker

Re-exports Worker