{"library":"scratch-parser","title":"Scratch Project Parser","description":"scratch-parser is a Node.js module designed for parsing and validating Scratch project files, including `.sb2` and `.sb3` formats. Its current stable version is 6.0.0. The library provides programmatic access to the internal structure of Scratch projects, enabling developers to inspect sprites, scripts, assets, and metadata. It has an active development cycle, with bug fixes and dependency updates released periodically, though major versions are less frequent. Key differentiators include its direct integration with the Scratch ecosystem, offering reliable parsing for official Scratch project formats, and its focus on providing a structured JavaScript object representation of the project data.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install scratch-parser"],"cli":null},"imports":["import parser from 'scratch-parser';","const parser = require('scratch-parser');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import fs from 'fs';\nimport parser from 'scratch-parser';\n\nconst projectBuffer = fs.readFileSync('/path/to/project.sb3'); // Or .sb2\n\nparser(projectBuffer, false, (err, project) => {\n    if (err) {\n        console.error('Error parsing Scratch project:', err);\n        // Depending on the error, you might want to log more details\n        // or return a default project structure.\n        return;\n    }\n    console.log('Successfully parsed Scratch project!');\n    console.log('Project title (if available):', project._meta ? project._meta.name : 'N/A');\n    console.log('Number of targets:', project.targets ? project.targets.length : 0);\n    // Example: Accessing a specific property or a sprite's data\n    // console.log('First sprite name:', project.targets[1] ? project.targets[1].name : 'No sprites');\n    // Further processing of the 'project' object can happen here.\n});\n","lang":"javascript","description":"Demonstrates how to read a Scratch project file from disk and parse it using the `scratch-parser` library, handling potential errors and logging basic project information.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}