> ## 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:

```typescript theme={null}
// Import the SCANOSS SDK using ES module syntax
import { Scanner, ScannerEvents } from "scanoss";

const scanner = new Scanner();

// Set the directory where scan results and fingerprints will be stored.
// If not set, the SDK will create a temporary folder with a timestamped name.
scanner.setWorkDirectory("/yourProjectFolder/ScanResults/");

// Triggered when the scan completes successfully
scanner.on(ScannerEvents.SCAN_DONE, (resultPath) => {
  console.log("Scan complete. Results at:", resultPath);
});

// Outputs internal scanner log messages
scanner.on(ScannerEvents.SCANNER_LOG, (msg) => {
  console.log(msg);
});

// Define the list of files to scan
const scannerInput = {
  fileList: ["/yourProjectFolder/example1.c", "/yourProjectFolder/example2.c"],
};

// Start the scan.
// scanner.scan() returns a Promise and can be awaited,
// in addition to being observable via events.
await scanner.scan([scannerInput]);
```
