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 🙏

© 2025 – Pkg Stats / Ryan Hefner

executely

v0.0.3

Published

Wrapper script around child_process execFile and spawn to make it more convenient to run bash commands from a node.js script.

Downloads

47

Readme

executely

What is executely?

"Executely" is not a real word. It's not in the dictionary. If the word had meaning then I'd imagine it to be something like "the act of performing a task or putting a plan into action." The closest correct word might be "executively", the adverb of "execute".

However, in this context, executely is a small library for making spawn and execFile, both Node.js child_process methods, slightly easier to work with.

I find that many times I try a command in the terminal first before copying it into code where I need to execute a process. Also, the reverse is true. I find I want to debug a command I've found in code, but to run it in the terminal typically involves reverse engineering the code to translate it from a spawn or execFile command to something that runs on the terminal. While spawn requires arguments be presented in an array, executely just takes everything as a string, just like on the terminal. Here are a few simple examples:

const executely = require('executely').execute;

executely('ls -ltrSha /etc');

With spawn, this might look like this:

const spawn = require('child_process').spawn;

spawn('ls', ['-ltrSha', '/etc']);

Imagine this is a very long command instead of a more simple one like the above examples. That's a lot more time and energy (or find/replace pattern matching skills) to get it back to something that runs in the terminal.

In addition, executely provides some hooks to allow developers to do stuff with the child process output. For instance, we can log it, and we can even look for patterns in the output and make branching decisions based off of it.

Usage

See the examples folder to learn how to use executely with simple examples.

// executely.execute(cmd, options, callbackFn) -> Promise

cmd - The string representation of the command to execute. For example, ls -ltr * options (Optional) - An object to specify stdoutEnabled (which uses execFile) and stderrEnabled (to enable/disable stderr when using execFile) -- stdoutEnabled: defaults to false -- stderrEnabled: defaults to true callbackFn (Optional) - A callback function to execute when processing the output from a command when using execFile only.

NOTE: options and callbackFn are used only in execFile mode, when stdoutEnabled is true.

// callbackFn(output, process, resolve, reject) -> no return value

output - The streamed output from the command, as a string process - The child process object resolve - The method to resolve the execute promise reject - The method to reject the execute promise

Spawn vs execFile

executely uses spawn by default, unless a boolean true is passed in as the second argument, in which case, we use execFile. execFile has some advantages. We can attach to the stdout stream and listen to any output from the process. executely takes a callback function as the third argument, which is used to do things like disable the output from the process or perhaps start executing other actions in an application.

One notable example I've used this for is to start a Selenium Standalone Chrome Docker container image and listen to the output to know when the Selenium server is up and running. Once I know the server is running, I can start running UI tests.

License

Copywright (c) James Mortensen, 2022 MIT License