/npm-tarball-license-parser

npm tarball license parser and conformance checker

Primary LanguageJavaScriptMIT LicenseMIT

npm tarball license parser

version Maintenance Security Responsible Disclosure mit dep

license parser

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
# or
$ yarn add @nodesecure/ntlp

Usage example

import parseLicense from "@nodesecure/ntlp";

async function main() {
    const license = await parseLicense(__dirname);
    console.log(license);
}
main().catch(console.error);

Return the following interface

interface license {
    uniqueLicenseIds: string[];
    spdxLicenseLinks: string[];
    spdx: {
        osi: boolean;
        fsf: boolean;
        fsfAndOsi: boolean;
        includesDeprecated: boolean;
    },
    from: string;
}

interface result {
    licenses: license[];
    uniqueLicenseIds: Set<string>;
}

API

parseLicense(dest: string): Promise< ntlp.result >

parse a given tarball directory and return a result interface.

License

MIT