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

ispawn

v0.2.0

Published

Spawn a process to inspect it.

Downloads

167

Readme

ispawn build status

Spawn a process to inspect it.

Installation

npm install ispawn

API

createSpawn

Configures a process to be spawned but doesn't spawn it yet

Parameters

  • $0 Objects options (same as @see spawn)

Returns Spawner that will spawn the configured process via spawner.spawn

spawn

Spawns a process with the given options allowing to intercept stdout and stderr output of the application itself or the underlying process, i.e. V8 and Node.js messages.

onStdout and onStderr interceptors

The functions, onStdout, onStderr called with each line written to the respective file descriptor have the following signature:

onStdout(line:String, fromApp:Boolean) where fromApp is true when the line came from the app itself and false when it came from the underlying runtime, i.e. Node.js or V8 when flags triggered diagnostics output.

To mark a line as handled return true from the function and it will not be printed to the console.

Example

 function onStdout(line, fromApp) {
   // Don't intercept app output, just have it printed as usual
   if (fromApp) return false
   // Do something with diagnositics messages here ...

   return true
 }
 const { termination } = spawn({
     execArgv: [ '--trace-turbo-inlining' ]
   , argv: [ require.resolve('./bind.js') ]
   , onStdout
 })

 try {
   const code = await termination
   console.log('The app returned with code', code)
 } catch (err) {
   console.error(err)
 }

full example

Parameters

  • $0 Object options
    • $0.execArgv Array<String>? arguments passed to Node.js/V8 directly (not to your app) (optional, default [])
    • $0.argv Array<String> file to run followed by flags to pass to your app
    • $0.node String? path to Node.js executable (optional, default process.execPath)
    • $0.spawnOpts Object? options passed to child_process.spawn (optional, default {})
    • $0.onStdout Function? function to call with each line written to stdout (optional, default null)
    • $0.onStderr Function? function to call with each line written to stderr (optional, default null)

Returns Object with the following properties- termination: {Promise} that resolves when process exits

  • proc: the spawned process

Kudos

Lots of the ideas and code were extracted from the 0x tool.

License

MIT