Socket
Book a DemoInstallSign in
Socket

@nodesecure/npm-security-fetcher

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodesecure/npm-security-fetcher

Fetch packages from npm for Security purposes

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
5
Created
Source

NPM Security Fetcher (WIP)

a Node.js CLI created to simplify the analysis of npm registry packages.

npm version license ossf scorecard

About

I personally created this project to analyze npm packages by various criteria (popularity etc). Most researchers re-create the same codes over and over again and I thought it might be nice to have a CLI and various methods to simplify our lives.

Features

  • Pull packages from the npm registry by divers criteria.
  • Offers you various methods to read and extract information from the npm tarball.
  • Functionalities can be extended

Requirements

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i npm-security-fetcher -g

or

$ git clone https://github.com/fraxken/npm-security-fetcher.git
$ cd npm-security-fetcher
$ npm ci
$ npm link

Then the nsf binary will be available in your terminal.

$ nsf --help

Usage example

The first step is to create a javascript file with three methods:

  • init (run before fetching and extracting packages from the npm registry).
  • run (called for each downloaded npm packages).
  • close (run at the end when there is no more packages to fetch).

This script must use the latest Node.js ESM (it also support top-level-await).

import path from "path";

export async function init() {
  const baseDir = path.join(process.cwd(), "results");

  return { baseDir }; // <-- init and return context object!
}

export async function close(ctx) {
  console.log("close triggered");
}

export async function run(ctx, { name, location, root }) {
  console.log(ctx.baseDir);
  console.log(`handle package name: ${name}, location: ${location}`);
}

There is no restriction on the nature of the context.

After editing your file you can run your script as follows

$ nsf npm myfile.js

The root folder "example" contains real world examples that are used (for js-x-ray etc).

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):

Gentilhomme
Gentilhomme

💻 📖 👀 🛡️ 🐛
Nicolas Hallaert
Nicolas Hallaert

📖
WildCöde
WildCöde

💻
Kouadio Fabrice Nguessan
Kouadio Fabrice Nguessan

🚧

License

MIT

Keywords

npm

FAQs

Package last updated on 18 Jun 2025

Did you know?

Socket

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