๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’

tinypool

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
t

tinypool

A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features

1.1.0
latest
100

Supply Chain Security

100

Vulnerability

76

Quality

89

Maintenance

100

License

Version published
Weekly downloads
9.8M
-6.67%
Maintainers
3
Weekly downloads
 
Created
Issues
9

What is tinypool?

The tinypool npm package is a minimalistic thread pool implementation for Node.js. It allows you to offload tasks to worker threads, which can improve the performance of CPU-intensive operations in a Node.js application by taking advantage of multi-threading.

What are tinypool's main functionalities?

Creating a thread pool

This feature allows you to create a thread pool with a specified number of worker threads. The 'task' option points to a JavaScript file that will be executed in the worker threads.

const { StaticPool } = require('tinypool');
const pool = new StaticPool({
  size: 4,
  task: './worker.js'
});

Running tasks in the pool

Once a thread pool is created, you can run tasks by passing data to the 'run' method. The method returns a promise that resolves with the result of the task executed in the worker thread.

pool.run({ some: 'data' }).then(result => {
  console.log(result);
});

Destroying the pool

When you are done with the thread pool, you can call the 'destroy' method to terminate all the worker threads and free up resources.

pool.destroy();

Other packages similar to tinypool

FAQs

Package last updated on 31 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts