# binwrap

> Package cross-platform binaries

Latest version **0.2.3** (published 2021-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install binwrap
pnpm add binwrap
yarn add binwrap
bun add binwrap
```

Provides the commands `binwrap-test`, `binwrap-install`, `binwrap-prepare`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2021-02-05 |
| First published | 2017-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 (+13 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Aaron VonderHaar |
| Maintainers | avh4 |

## Links

- npm: https://www.npmjs.com/package/binwrap
- Repository: https://github.com/avh4/binwrap
- Homepage: https://github.com/avh4/binwrap#readme
- Issues: https://github.com/avh4/binwrap/issues
- npm.io page: https://npm.io/package/binwrap

## Dependencies (3)

- [tar](https://npm.io/package/tar.md) ^6.1.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [unzip-stream](https://npm.io/package/unzip-stream.md) ^0.3.1

## Recent versions

- 0.2.3 (latest) — 2021-02-05
- 0.2.0-rc2 (rc) — 2018-06-05
- 0.2.2 — 2019-08-07
- 0.2.1 — 2019-05-09
- 0.2.0 — 2018-08-18
- 0.2.0-rc1 — 2018-06-02
- 0.1.4 — 2017-04-02
- 0.1.3 — 2017-04-02
- 0.1.2 — 2017-04-02
- 0.1.1 — 2017-04-02
- 0.1.0 — 2017-04-02

## README

[![Build Status](https://travis-ci.org/avh4/binwrap.svg?branch=master)](https://travis-ci.org/avh4/binwrap) [![npm](https://img.shields.io/npm/v/binwrap.svg)](https://www.npmjs.com/package/binwrap)

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:

```json
{
  "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:

```javascript
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):

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

---
_Source: https://npm.io/package/binwrap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
