Socket
Book a DemoInstallSign in
Socket

@nodesecure/ntlp

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodesecure/ntlp

npm tarball license parser and conformance checker

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
14
-54.84%
Maintainers
5
Weekly downloads
 
Created
Source

npm tarball license parser

version Maintenance OpenSSF
Scorecard mit build

Fetch all licenses and their SPDX conformance from a given npm tarball.

Requirements

  • Node.js v18 or higher

Getting Started

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

$ npm i @nodesecure/ntlp
# or
$ yarn add @nodesecure/ntlp

Usage example

import * as ntlp from "@nodesecure/ntlp";

// Asynchronous
{
  const licenses = await ntlp.extractLicenses(process.cwd());
  console.log(licenses);
}

// Synchronous
{
  const licenses = ntlp.extractLicensesSync(process.cwd());
  console.log(licenses);
}

API

extractLicenses(location: string, options?: extractAsyncOptions): Promise< SpdxExtractedResult >

Search and parse all licenses at the given location.

Return all licenses with their SPDX conformance.

import {
  spdxLicenseConformance
} from "@nodesecure/licenses-conformance";

export interface SpdxLicenseConformance extends spdxLicenseConformance {
  from: string;
}

export interface SpdxExtractedResult {
  /**
   * List of license (with their SPDX conformance)
   */
  licenses: SpdxLicenseConformance[];
  /**
   * Has multiple unique licenses (MIT, ISC ..)
   */
  hasMultipleLicenses: boolean;
  /**
   * Unique list of license (MIT, ISC). The list cannot contain duplicate.
   */
  uniqueLicenseIds: string[];
  /**
   * List of licenses with no SPDX (or with invalid ids).
   */
  invalidLicenseIds: string[];
}

extractLicensesSync(location: string, options?: ExtractSyncOptions): SpdxExtractedResult

Same as extractLicenses but use synchronous FS API.

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):

Gentilhomme
Gentilhomme

💻 📖 👀 🛡️ 🐛
Tony Gorez
Tony Gorez

💻 📖 👀
Quentin Lepateley
Quentin Lepateley

📖
Nicolas Hallaert
Nicolas Hallaert

📖
Vincent Dhennin
Vincent Dhennin

💻
Kouadio Fabrice Nguessan
Kouadio Fabrice Nguessan

🚧

License

MIT

Keywords

license

FAQs

Package last updated on 18 Mar 2024

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