npm tarball license parser
Fetch all licenses and their SPDX conformance from a given npm tarball.
Requirements
Getting Started
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @nodesecure/ntlp
$ yarn add @nodesecure/ntlp
Usage example
import * as ntlp from "@nodesecure/ntlp";
{
const licenses = await ntlp.extractLicenses(process.cwd());
console.log(licenses);
}
{
const licenses = ntlp.extractLicensesSync(process.cwd());
console.log(licenses);
}
API
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 {
licenses: SpdxLicenseConformance[];
hasMultipleLicenses: boolean;
uniqueLicenseIds: string[];
invalidLicenseIds: string[];
}
Same as extractLicenses
but use synchronous FS API.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
License
MIT