> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanoss.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> The <a href='https://github.com/scanoss/scanoss.js' target='_blank' rel='noopener noreferrer'>SCANOSS JS</a> SDK provides a JavaScript module for interacting with the SCANOSS API and scanning engine directly from your JavaScript projects.

## Prerequisites

Before you begin, ensure you have:

* [Node.js 18](https://nodejs.org/en) or higher

## Installation

```bash theme={null}
npm install scanoss
```

## Import Styles

The package supports both ES module and CommonJS import styles:

```typescript theme={null}
// ES module
import { Scanner, ScannerEvents, ScannerCfg } from "scanoss";
```

```javascript theme={null}
// CommonJS
const { Scanner, ScannerEvents, ScannerCfg } = require("scanoss");
```

## Quick Start

The following example runs a scan using the default SCANOSS configuration:

```javascript theme={null}
// Import as ES6
import { Scanner, ScannerEvents } from "scanoss";

// Import as CommonJS
// const { Scanner, ScannerEvents } = require('scanoss');

const scanner = new Scanner();

// Set the folder path where the module will save the scan results and fingerprints
// If is not specified, the module will create a folder on tmp
// directory using a timestamp as a name
scanner.setWorkDirectory("/yourProjectFolder/ScanResults/");

// Set the scanner log event handler
scanner.on(ScannerEvents.SCANNER_LOG, (logTxt) => console.log(logTxt));

// Set the scanner finish event handler
scanner.on(ScannerEvents.SCAN_DONE, (resultPath) => {
  console.log("Path to results: ", resultPath);
});

const scannerInput = {
  fileList: ["/yourProjectFolder/example1.c"],
};

// Launch the scanner
scanner.scan([scannerInput]);
```
