Distribute binaries via npm
Branch: master
Clone or download
Latest commit 14f9665 Aug 18, 2018


Build Status npm

This package helps with distributing binaries via npm.


First, create your compiled binaries and make them available via HTTPS.

Now create your npm installer: Make a package.json that looks like this:

  "name": "myApp",
  "version": "1.0.0",
  "description": "Install myApp",
  "preferGlobal": true,
  "main": "index.js",
  "scripts": {
    "install": "binwrap-install",
    "prepare": "binwrap-prepare",
    "test": "binwrap-test",
    "prepublish": "npm test"
  "license": "BSD-3-Clause",
  "files": [
  "bin": {
    "myapp-cli": "bin/myapp-cli"
  "dependencies": {
    "binwrap": "^0.2.0"

Then create your index.js file like this:

var binwrap = require("binwrap");
var path = require("path");

var packageInfo = require(path.join(__dirname, "package.json"));
var version = packageInfo.version;
var root = "https://dl.bintray.com/me/myApp/" + version;

module.exports = binwrap({
  dirname: __dirname,
  binaries: [
  urls: {
    "darwin-x64": root + "/mac-x64.tgz",
    "linux-x64": root + "/linux-x64.tgz",
    "win32-x64": root + "/win-i386.zip",
    "win32-ia32": root + "/win-i386.zip"

Then run npm test to verify that your packages are published correctly.

Finally, run npm publish when you are ready to publish your installer.