Socket
Socket
Sign inDemoInstall

license-crawler

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    license-crawler

crawls a npm package and it's dependencies for their licenses


Version published
Weekly downloads
75
increased by10.29%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

license-crawler

crawls a npm package and it's dependencies for their licenses

Installation

npm
npm install license-crawler

Usage

NodeJS Example

// Import license-crawler
var crawler = require('license-crawler');



// setting options
const options = {
  input: './',                  // input folder which contains package.json
  out: './reportLicenses.json', // output file
  production: false,            // if true don't check devDependencies
  statistics: true,             // generate statistics
  exclude: [],
  sorted: 'license',            // 'license' or 'package'
  format: 'json',               // 'json' or 'txt'
};

// Set configuration
crawler.crawlLicenses(options);

JavaScript Example

// Import license-crawler
var crawler = require('license-crawler');

crawler.crawlLicenses({
  input: './',                  // input folder which contains package.json
  out: './reportLicenses.json', // output file
  production: false,             // if true don't check devDependencies
  statistics: true,             // generate statistics
  exclude: [],
  sorted: 'license',            // 'license' or 'package'
  format: 'json',               // 'json' or 'txt'
});

Output

format: 'json' license sorted

{
  "MIT": {
    "total": 34,
    "percentage": "45.33 %",
    "packages": [...]
  },
  "Apache-2.0": {
    "total": 24,
    "percentage": "32 %",
    "packages": [...]
  },
  "ISC": {
    "total": 11,
    "percentage": "14.67 %",
    "packages": [...]
  },
  "BSD-3-Clause": {
    "total": 2,
    "percentage": "2.67 %",
    "packages": [...]
  },
  "BSD-2-Clause": {
    "total": 1,
    "percentage": "1.33 %",
    "packages": [...]
  },
  "UNKNOWN": {
    "total": 3,
    "percentage": "4 %",
    "packages": [...]
  }
}

format: 'txt' package sorted

├─license-crawler@0.0.3:
│  ├─ license: MIT
│  ├─@types/node@9.6.6:
│  │  ├─ license: MIT
│  ├─tslint@5.9.1:
│  │  ├─ license: Apache-2.0
│  │  ├─babel-code-frame@^6.22.0:
│  │  │  ├─ license: MIT

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Last updated on 03 Jun 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc