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 🙏

© 2024 – Pkg Stats / Ryan Hefner

bin-links

v4.0.3

Published

JavaScript package binary linker

Downloads

9,430,609

Readme

bin-links npm version license Travis AppVeyor Coverage Status

bin-links is a standalone library that links binaries and man pages for JavaScript packages

Install

$ npm install bin-links

Table of Contents

Example

const binLinks = require('bin-links')
const readPackageJson = require('read-package-json-fast')
binLinks({
  path: '/path/to/node_modules/some-package',
  pkg: readPackageJson('/path/to/node_modules/some-package/package.json'),

  // true if it's a global install, false for local.  default: false
  global: true,

  // true if it's the top level package being installed, false otherwise
  top: true,

  // true if you'd like to recklessly overwrite files.
  force: true,
})

Features

  • Links bin files listed under the bin property of pkg to the node_modules/.bin directory of the installing environment. (Or ${prefix}/bin for top level global packages on unix, and ${prefix} for top level global packages on Windows.)
  • Links man files listed under the man property of pkg to the share/man directory. (This is only done for top-level global packages on Unix systems.)

Contributing

The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The Contributor Guide has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.

API

> binLinks({path, pkg, force, global, top})

Returns a Promise that resolves when the requisite things have been linked.

> binLinks.getPaths({path, pkg, global, top })

Returns an array of all the paths of links and shims that might be created (assuming that they exist!) for the package at the specified path.

Does not touch the filesystem.

> binLinks.checkBins({path, pkg, global, top, force })

Checks if there are any conflicting bins which will prevent the linking of bins for the given package. Returns a Promise that resolves with no value if the way is clear, and rejects if there's something in the way.

Always returns successfully if global or top are false, or if force is true, or if the pkg object does not contain any bins to link.

Note that changes to the file system may still cause the binLinks method to fail even if this method succeeds. Does not check for conflicting man links.

Reads from the filesystem but does not make any changes.

Example
binLinks({path, pkg, force, global, top}).then(() => console.log('bins linked!'))