Skip to content

Commit 9cee6b0

Browse files
authored
Merge pull request #1 from Parallel-7/feature/add-professional-readme
docs: Create professional README
2 parents 407ba72 + 61f98f6 commit 9cee6b0

2 files changed

Lines changed: 84 additions & 2 deletions

File tree

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Slicer Meta Parser
2+
3+
A TypeScript library for parsing metadata from 3D printing slicer files. This library extracts key information from G-Code, GX, and 3MF files, such as slicer information, print settings, and filament usage.
4+
5+
## Features
6+
7+
- Parses metadata from various slicer file formats.
8+
- Supports G-Code, GX, and 3MF files.
9+
- Automatically detects the file type based on the extension.
10+
- Provides a simple, unified interface for different file types.
11+
12+
## Installation
13+
14+
To install this package, you need to configure npm to use the GitHub Packages registry.
15+
16+
Add the following to a `.npmrc` file in your project's root directory:
17+
18+
```
19+
@parallel-7:registry=https://npm.pkg.github.com/
20+
```
21+
22+
Then, install the package as usual:
23+
24+
```bash
25+
npm install @parallel-7/slicer-meta
26+
```
27+
28+
You will need to authenticate with GitHub Packages to download private packages.
29+
30+
## Usage
31+
32+
The primary way to use the library is with the `parseSlicerFile` function, which automatically handles different file formats.
33+
34+
```typescript
35+
import { parseSlicerFile } from '@parallel-7/slicer-meta';
36+
37+
async function main() {
38+
try {
39+
const filePath = 'path/to/your/file.gcode';
40+
const metadata = await parseSlicerFile(filePath);
41+
42+
console.log('Slicer Info:', metadata.slicer);
43+
console.log('File Info:', metadata.file);
44+
45+
if (metadata.threeMf) {
46+
console.log('3MF Specific Info:', metadata.threeMf);
47+
}
48+
} catch (error) {
49+
console.error('Failed to parse file:', error);
50+
}
51+
}
52+
53+
main();
54+
```
55+
56+
## Advanced Usage
57+
58+
For more specific use cases, you can use the individual parsers directly. This can be useful if you know the file type in advance or need more control over the parsing process.
59+
60+
The following parsers are available:
61+
62+
- `GCodeParser`
63+
- `FlashPrintParser`
64+
- `OrcaFlashForgeParser`
65+
- `GXParser`
66+
- `ThreeMfParser`
67+
68+
### Example
69+
70+
```typescript
71+
import { GCodeParser } from '@parallel-7/slicer-meta';
72+
73+
async function parseGCode() {
74+
const parser = new GCodeParser();
75+
await parser.parse('path/to/your/file.gcode');
76+
77+
console.log('Slicer Info:', parser.slicerInfo);
78+
console.log('File Info:', parser.fileInfo);
79+
}
80+
81+
parseGCode();
82+
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)