API
Methods​
generateLicenseFile Async​
generateLicenseFile(pathToPackageJson: string, outputPath: string, lineEnding?: "crlf" | "lf"): Promise<void>
Scans the project found at the given path and creates a license file at the given output location
Parameters
pathToPackageJson: string
- A path to the package.json for the projectoutputPath: string
- A file path for the resulting license filelineEnding?: "crlf" | "lf"
- Will use the system default if omitted
Returns
Promise<void>
getLicenseFileText Async​
getLicenseFileText(pathToPackageJson: string, lineEnding?: "crlf" | "lf"): Promise<string>
Scans the project found at the given path and returns a string containing the licenses for all the dependencies
Parameters
pathToPackageJson: string
- A path to the package.json for the projectlineEnding?: "crlf" | "lf"
- Will use the system default if omitted
Returns
Promise<string>
- A promise that resolves to the license file text
getProjectLicenses Async​
getProjectLicenses(pathToPackageJson: string): Promise<ILicense[]>
Scans the project found at the given path and returns an array of objects each containing the details of an identified license and the dependencies it pertains to.
Parameters
pathToPackageJson: string
- A path to the package.json for the project
Returns
Promise<ILicense[]>
- Array of ILicense objects, each containing the license content and respective dependencies
Models​
ILicense​
Contains the content of a given license and the list of dependencies it pertains to. It is returned from getProjectLicenses
Properties
-
content: string
- Body of the license. -
dependencies: string[]
- List of node packages that this license applies to.