How to get npm package access from the command line?

Viewed 101

I can't seem to find any way to determine an npm packages access level in the npmjs.org registry without looking at the web page. I assumed there would be some way to get this information from the command line, but neither npm access nor npm view seem to provide this information.

Is there any way to determine whether a package is public or private from the command line?

I realize that it would be possible to screen scrape this from the npmjs.org site, but I'm discounting that as infeasible for all the reasons.

1 Answers

Workable if ugly:

  • Attempt to download a package using curl. If successful, it's public.
  • If necessary to ensure the package exists or is private and accessible to you, you would still need to check for package with npm view or something.

Thanks to @charles-lowell for prompt.

Related