File tree Expand file tree Collapse file tree 3 files changed +52
-2
lines changed
Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Package to npmjs
2+ on :
3+ release :
4+ types : [published]
5+ jobs :
6+ build :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v3
10+ # Setup .npmrc file to publish to npm
11+ - uses : actions/setup-node@v3
12+ with :
13+ node-version : ' 16.x'
14+ registry-url : ' https://registry.npmjs.org'
15+ - run : yarn
16+ - run : yarn publish
17+ env :
18+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 11# RFIL
22
3- Use our NPM package!
3+ Use our NPM package [ here ] ( https://www.npmjs.com/package/rfil ) !
44``` bash
55npm i rfil
66```
77
8+ or use yarn
9+ ``` bash
10+ yarn add rfil
11+ ```
12+
813## Usage
914
1015You can either use commonjs or esm.
@@ -41,6 +46,33 @@ const data = parse(buffer);
4146console .log (data);
4247```
4348
49+ ### Exporting raw files
50+
51+ Here's an example on how to export raw files from a RFIL file.
52+
53+ ``` js
54+ import { parse } from ' rfil' ;
55+ import fs from ' node:fs' ;
56+ import path from ' node:path' ;
57+
58+ // Read a buffer from a file
59+ const buffer = fs .readFileSync (' file.rfil' );
60+
61+ // Parse the buffer
62+ const data = parse (buffer);
63+
64+ // Check for data
65+ if (! data .hasData ()) {
66+ console .log (' An error occurred: %s' , data .hasError () ? data .unwrapError () : ' [Unknown error]' );
67+ process .exit (1 );
68+ }
69+
70+ // Write files
71+ data .unwrap ().data .forEach ((data , index ) => {
72+ fs .writeFileSync (path .join (process .cwd (), ` out${ index} .raw` ), data .data );
73+ });
74+ ```
75+
4476
4577## RFIL File Format
4678
Original file line number Diff line number Diff line change 33 "version" : " 1.0.1" ,
44 "description" : " RFIL file format for flipper" ,
55 "main" : " dist/index.min.cjs" ,
6- "types" : " dist/index.d.ts " ,
6+ "types" : " dist/index.min.d.cts " ,
77 "module" : " dist/index.min.mjs" ,
88 "type" : " module" ,
99 "repository" : " https://github.com/JoshuaBrest/flipper-rfil" ,
You can’t perform that action at this time.
0 commit comments