npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tadpole

v0.0.7

Published

Node's child_process made easy.

Downloads

18

Readme

#Tadpole - Node's child_process made easy

NPM Build Status

##About Tadpole Tadpole takes the pain out of multithreaded JavaScript. Using Node's child_process module and the Bluebird promise library, it's easy to run code in other processes while keeping Node's event loop spinning freely.

Tadpole can spin up additional processes, each a full instance of the V8 interpreter. You can then add functions to the collected processes while they are already running. If you need to clear system resources, you can remove unneeded processes; if you need additional capacity for expensive workloads, you can add additional processes, and your stored functions will be automatically added to the new children.

In addition, Tadpole manages the child processes such that only one task is run at a time, with others waiting in a queue. In priority mode (default), each function is given a priority, and lower priority functions dequeued first.

##Known Issues This is alpha software, so please treat it as such - it is likely unwise to use this in production.

##Installation To install Tadpole, simply enter npm install tadpole --save at the command line. Then using Tadpole in your project is as easy as: var Tadpole = require('tadpole'); Note that Tadpole requires Node 0.11 or higher (or IO.js).

##Using Tadpole ####spawn(options) This initializes Tadpole and spins up the child processes. You must call tadpole.spawn() before any other methods. This method accepts an options object with the following keys:

  • numChildren - The number of child processes to create. Default: the number of host cores minus 1.
  • priority - If true, each function passd to Tadpole can be assigned an integer priority greater than 0. When dequeuning the next workload, functions with lower priority values will be dequeued first. Default: true.
  • env - If set, this value is passed as the value of process.env in the child process. Default: process.env of parent.
  • respawn - If true, Tadpole attempts to automatically respawn child processes that shut down due to error. Default: true.

####addFunction(functionObject) Adds a function to all child processes, returning a Promise that resolves to true when the function has been successfully added. Accepts an object literal with the following keys:

  • name - A string representaiton used to later run the function.
  • func - The function to execute. This can access any feature an instance of Node would, i.e. CommonJS require statements. However, it cannot reference any functions outside its own scope. It should return a value.
  • priority - The integer value representing the priority with which requests for function calls of this type should be dequeued. Lower values are dequeued first. Must be greater than 0. Default: 100.

####run(name[, args]) Runs the function indicated by the string name, supplying any additional arguments to that function.

run returns a Promise that resolves to the result of the function call, or is rejected if an error occurs.


####add([num]) Adds num child processes. Default: 1.


####remove([num]) Removes num child processes. Default: 1.


####size() Returns the current number of child processes.


####killAll() Shuts down all child processes and returns Tadpole to its uninitialized state, including erasing all functions added.