binwrap
Package cross-platform binaries
Last updated 7 years ago by avh4 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install binwrap 
SYNC missed versions from official npm registry.

Build Status npm

This package helps with distributing binaries via npm.

Usage

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": [
    "index.js",
    "bin"
  ],
  "bin": {
    "myapp-cli": "bin/myapp-cli"
  },
  "dependencies": {
    "binwrap": "^0.2.3"
  }
}

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: [
    "myapp-cli"
  ],
  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.

Javascript API

Javascript code can get the absolute path to a binary from a package that uses binwrap as follows (in this example, "my-package" is a published npm package that uses binwrap, and has a my-package-cli binary):

const cliPath = require('my-package').paths['my-package-cli'];

Current Tags

  • 0.2.3                                ...           latest (5 years ago)
  • 0.2.0-rc2                                ...           rc (8 years ago)

11 Versions

  • 0.2.3                                ...           5 years ago
  • 0.2.2                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           8 years ago
  • 0.2.0-rc2                                ...           8 years ago
  • 0.2.0-rc1                                ...           8 years ago
  • 0.1.4                                ...           9 years ago
  • 0.1.3                                ...           9 years ago
  • 0.1.2                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 3
Last Month 3
Dependencies (5)
Dev Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |