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 🙏

© 2026 – Pkg Stats / Ryan Hefner

get-binary

v1.0.0

Published

Automated module to fetch all your 3rd party binaries to power your nodejs applications

Readme

What?

This module is used to fetch and extract binaries required for your apps, where no supported binaries are found to be installed or previously downloaded.

Why?

I wrote this module at a time when I was building an app that relies on QuestDB. I needed to be able to deploy the app without having to worry about the existence or lack thereof of QuestDB binaries.

How?

First install yarn add get-binary;

Then start the process by passing the correct options to determine the right binary for each Operating system.

const getB = require('get-binary');

const requiredBinaries = [
    {
        // required
        name: 'FFMPEG',
        // the os variant to target
        os: {
            platform: 'linux',
            arch: 'x64',
        },
        // remote URL to get binary from
        remote: {
            url: 'https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v3.2/ffplay-3.2.2-linux-64.zip',
        },
        // Local values
        local: {
            // the command to run in order to check if the binary is already installed
            // this is run using the "which" command
            whichCmd: ['ffmpeg'],
            // directory to save the binary
            dir: '/path/to/save/binaries',
            // name of the binary
            name: 'ffmpeg',
        },
    },
    {
        name: 'FFMPEG',
        os: {
            platform: 'windows',
            arch: 'x64',
        },
        remote: {
            url: 'https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2.1/ffplay-4.2.1-win-64.zip',
        },
        local: {
            whichCmd: ['ffmpeg'],
            dir: '/path/to/save/binaries',
            name: 'ffmpeg',
        },
    },
    //{...other os variants or binaries}
];

// now get the binaries
getB.get(requiredBinaries)
    .then((fetchedBinaries) => {
        // all binaries fetched....
        console.log(fetchedBinaries);
    })
    .catch(console.error);

How it works

  • The array of required binaries is filtered using platform and arch values returned by the os module.
    • If the .os key is missing, then the binary is assumed to match all operating systems. Omitting this key is the way to deal with cross-platform binaries.
  • Every matched binary is downloaded if:
    • The whichCmd is missing or when run using which, does not find any installed binaries and...
    • ...no downloaded binary is found at the path given by local.dir/local.name
  • An array of all binaries already existing, or freshly downloaded is returned...

In the example above, the following binaries are returned for my case:

{ 
    binaries: { FFMPEG: [ '/usr/bin/ffmpeg' ] }, 
    errors: [] 
}

This is because I already have ffmpeg installed and the which command returns the installation path.

Otherwise, the binary would have been downloaded, unzipped and the path to the freshly unzipped files returned.

API

getB.get(requiredBinaries, [forceFetch])

Returns an object of binaries (already installed or downloaded) as indicated for that operating system, and an array or all errors encountered.

requiredBinaries

Type: Array This argument should be an array containing details for each binary to be installed on the specific operating system.

Binary Details

| Property | Description | Required | | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | name | String The name of the binary. It is also the name of the binary returned. Example: {FFMPEG:['/usr/bin/ffmpeg']} where FFMPEG was the name entered. | Yes | | os | Object Holds details about the operating system that the binary is intended for. This Object should contain platform and arch keys. Example: {platform:'windows',arch:'x64'} | No | | remote | Object Details of where to download the binary from. The object must have a url key which must be a valid URL. | Yes | | local| Object Details of where to download the binary to. The object must contain a dir and name. Values of dir and name must combine (using path.join()) to form a valid path on your machine or else creating binary directories will fail. | Yes |

forceFetch

Type: Boolean If true, then a new binary is always downloaded irrespective of whether whichCmd finds an installed binary or one was previously downloaded. If a binary had already been downloaded, then all files will be replaced.

This option is useful if you want to force you app to download the latest binaries.

Sample Installation for multiple binaries

Have a look at this Test File for a good example on how to get multiple binaries across different platforms.