https://github.com/parallel-7/slicer-meta
Cross Platform API in TypeScript for extracting metadata from G-Code/3MF files
https://github.com/parallel-7/slicer-meta
3d-printing slicing
Last synced: 23 days ago
JSON representation
Cross Platform API in TypeScript for extracting metadata from G-Code/3MF files
- Host: GitHub
- URL: https://github.com/parallel-7/slicer-meta
- Owner: Parallel-7
- Created: 2025-05-09T03:28:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-21T00:25:21.000Z (about 1 month ago)
- Last Synced: 2026-05-21T06:53:45.963Z (about 1 month ago)
- Topics: 3d-printing, slicing
- Language: G-code
- Homepage: https://flashforge.dev
- Size: 12.7 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slicer Meta Parser
A TypeScript library for parsing metadata from 3D printing slicer files
[](https://www.npmjs.com/package/@parallel-7/slicer-meta)
[](https://nodejs.org)
[](https://www.typescriptlang.org/)
[](https://github.com/Parallel-7/slicer-meta)
---
## Quick Start
Add the GitHub Packages registry to `.npmrc` in your project root:
```
@parallel-7:registry=https://npm.pkg.github.com/
```
Install the package:
```bash
npm install @parallel-7/slicer-meta
```
> You will need to authenticate with GitHub Packages to install private packages.
Use the `parseSlicerFile` function — it automatically handles all supported formats:
```typescript
import { parseSlicerFile } from '@parallel-7/slicer-meta';
const metadata = await parseSlicerFile('path/to/your/file.gcode');
console.log('Slicer:', metadata.slicer);
console.log('File info:', metadata.file);
if (metadata.threeMf) {
console.log('3MF data:', metadata.threeMf);
}
```
---
## Features
- **Three file formats** — G-Code (`.gcode`, `.g`), FlashForge binary (`.gx`), and 3MF archives (`.3mf`)
- **Four slicers detected** — FlashPrint, Orca-FlashForge, OrcaSlicer, and Legacy GX, identified from file headers
- **Thumbnail extraction** — Base64 thumbnails from G-Code and 3MF; binary thumbnails from GX files
- **Filament tracking** — Usage in mm, meters, and grams; per-filament color and type for multi-material prints
- **3MF-specific data** — Support detection, plate preview images, and model file names from the archive
- **Single unified API** — `parseSlicerFile` dispatches to the right parser automatically; individual parsers also exported for direct use
---
## API
| Parser | File Types | Notes |
|--------|-----------|-------|
| `GCodeParser` | `.gcode`, `.g` | Auto-detects FlashPrint vs Orca-FlashForge vs OrcaSlicer |
| `FlashPrintParser` | `.gcode` | FlashPrint-specific files |
| `OrcaFlashForgeParser` | `.gcode` | Orca-FlashForge files |
| `GXParser` | `.gx` | FlashForge binary format |
| `ThreeMfParser` | `.3mf` | 3MF archives (optimized for OrcaSlicer) |
For full return type definitions (Slicer Metadata, File Metadata, 3MF Specific Data), see [docs/api.md](docs/api.md).
For per-parser examples and multi-filament usage, see [docs/usage.md](docs/usage.md).
---
## Development
```bash
npm run build # compile TypeScript
npm test # run tests
```