Socket
Socket
Sign inDemoInstall

cur-env-bin

Package Overview
Dependencies
13
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cur-env-bin

Automatically find files that match the current environment.


Version published
Maintainers
1
Install size
2.23 MB
Created

Readme

Source

Automatically find files that match the current environment.

Suppose you need to use nodejs to call a binary file, this tool can help you quickly be compatible with various platforms and CPU architectures.

example

Get the syncthing executable for the current platform:

const decompress = require(`decompress`);
const { binShim, getBinFile } = require(`cur-env-bin`);

const binPath = await binShim({
  cwd: __dirname,
  owner: `syncthing`,
  repo: `syncthing`,
  fileListFn: async (github) => github.byTag(`v1.23.2`),
  async binFileFn({ file, saveDir, downloadPath }) {
    const decompressDir = `${saveDir}/file`;
    await decompress(downloadPath, decompressDir, { strip: 1 });
    return getBinFile({ dir: decompressDir, name: `syncthing` });
  },
});

require(`child_process`).execSync(binPath, { stdio: `inherit` });

Allow configuration of proxy

# win
set http_proxy=http://127.0.0.1:1081

# linux
export http_proxy=http://127.0.0.1:1081

license

MIT

Keywords

FAQs

Last updated on 30 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc