The following example runs a scan using the default SCANOSS configuration:
// Import the SCANOSS SDK using ES module syntaximport { 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 successfullyscanner.on(ScannerEvents.SCAN_DONE, (resultPath) => { console.log("Scan complete. Results at:", resultPath);});// Outputs internal scanner log messagesscanner.on(ScannerEvents.SCANNER_LOG, (msg) => { console.log(msg);});// Define the list of files to scanconst 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]);