@mattnucc/gribberish 0.28.2 → 0.28.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -54
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mattnucc/gribberish
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Node.js bindings for [gribberish](https://crates.io/crates/gribberish), a Rust GRIB2 reader.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This package is a **reader only**. Loading GRIB2 bytes from local files, object stores, or network sources is intentionally left to your application.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
2. **Clone** your project.
|
|
11
|
-
3. Run `yarn install` to install dependencies.
|
|
12
|
-
4. Run `yarn napi rename -n [@your-scope/package-name] -b [binary-name]` command under the project folder to rename your package.
|
|
13
|
-
|
|
14
|
-
## Install this test package
|
|
9
|
+
## Install
|
|
15
10
|
|
|
16
11
|
```bash
|
|
17
|
-
yarn add @
|
|
12
|
+
yarn add @mattnucc/gribberish
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Build
|
|
23
|
-
|
|
24
|
-
After `yarn build/npm run build` command, you can see `package-template.[darwin|win32|linux].node` file in project root. This is the native addon built from [lib.rs](./src/lib.rs).
|
|
25
|
-
|
|
26
|
-
### Test
|
|
15
|
+
or
|
|
27
16
|
|
|
28
|
-
|
|
17
|
+
```bash
|
|
18
|
+
npm install @mattnucc/gribberish
|
|
19
|
+
```
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
## Usage
|
|
31
22
|
|
|
32
|
-
|
|
23
|
+
Read the first message in a GRIB2 file:
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
```ts
|
|
26
|
+
import { readFileSync } from 'node:fs'
|
|
27
|
+
import { GribMessageFactory } from '@mattnucc/gribberish'
|
|
35
28
|
|
|
36
|
-
|
|
29
|
+
const data = readFileSync('sample.grib2')
|
|
30
|
+
const factory = GribMessageFactory.fromBuffer(data)
|
|
31
|
+
const first = factory.getMessage(factory.availableMessages[0])
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
console.log(first.varName, first.gridShape.rows, first.gridShape.cols)
|
|
34
|
+
```
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
Common entry points:
|
|
41
37
|
|
|
42
|
-
|
|
38
|
+
- `parseMessagesFromBuffer(buffer)` to parse all messages.
|
|
39
|
+
- `GribMessage.parseFromBuffer(buffer, offset)` to parse one message at a known offset.
|
|
40
|
+
- `GribMessageFactory.fromBuffer` to scan and fetch messages by key.
|
|
41
|
+
- `GribMessageMetadataFactory.fromBuffer` for metadata-first access.
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
## WebAssembly targets
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
WebAssembly packages are optional, so install with a wasm target selector instead of adding the package explicitly.
|
|
47
46
|
|
|
48
|
-
-
|
|
49
|
-
- Install `Node.js@10+` which fully supported `Node-API`
|
|
50
|
-
- Install `yarn@1.x`
|
|
47
|
+
- npm (v10.2+):
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
```bash
|
|
50
|
+
npm install --cpu=wasm32 @mattnucc/gribberish
|
|
51
|
+
```
|
|
53
52
|
|
|
54
|
-
- yarn
|
|
55
|
-
- yarn build
|
|
56
|
-
- yarn test
|
|
53
|
+
- yarn v4:
|
|
57
54
|
|
|
58
|
-
|
|
55
|
+
```yaml
|
|
56
|
+
# .yarnrc.yml
|
|
57
|
+
supportedArchitectures:
|
|
58
|
+
cpu:
|
|
59
|
+
- current
|
|
60
|
+
- wasm32
|
|
61
|
+
```
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
$ ava --verbose
|
|
63
|
+
Then run `yarn install`.
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
✔ sleep function from native code (201ms)
|
|
65
|
-
─
|
|
65
|
+
In Node, set `NAPI_RS_FORCE_WASI=1` (or `NAPI_RS_FORCE_WASI=error`) if you want to force the WASM runtime path.
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
✨ Done in 1.12s.
|
|
69
|
-
```
|
|
67
|
+
## Build and test
|
|
70
68
|
|
|
71
|
-
|
|
69
|
+
- `yarn install`
|
|
70
|
+
- `yarn build`
|
|
71
|
+
- `yarn test`
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
## Requirements
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
- Rust toolchain
|
|
76
|
+
- Node.js (CI validates on 20/22; release jobs run on 24)
|
|
77
|
+
- Yarn 4.x (`packageManager: yarn@4.12.0`)
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
## Release workflow
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
|
|
81
|
+
The `js` workflow publishes artifacts from GitHub Actions when you push a version tag.
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
1. `npm version [major | minor | patch | ...]`
|
|
84
|
+
2. `git push --follow-tags`
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
Make sure `NPM_TOKEN` is set in repository secrets.
|
|
86
87
|
|
|
87
|
-
>
|
|
88
|
+
> Do not run `npm publish` manually.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mattnucc/gribberish",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.5",
|
|
4
4
|
"description": "JavaScript bindings for gribberish, a GRIB2 parsing library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
},
|
|
107
107
|
"packageManager": "yarn@4.12.0",
|
|
108
108
|
"optionalDependencies": {
|
|
109
|
-
"@mattnucc/gribberish-win32-x64-msvc": "0.28.
|
|
110
|
-
"@mattnucc/gribberish-darwin-x64": "0.28.
|
|
111
|
-
"@mattnucc/gribberish-linux-x64-gnu": "0.28.
|
|
112
|
-
"@mattnucc/gribberish-darwin-arm64": "0.28.
|
|
113
|
-
"@mattnucc/gribberish-wasm32-wasi": "0.28.
|
|
109
|
+
"@mattnucc/gribberish-win32-x64-msvc": "0.28.5",
|
|
110
|
+
"@mattnucc/gribberish-darwin-x64": "0.28.5",
|
|
111
|
+
"@mattnucc/gribberish-linux-x64-gnu": "0.28.5",
|
|
112
|
+
"@mattnucc/gribberish-darwin-arm64": "0.28.5",
|
|
113
|
+
"@mattnucc/gribberish-wasm32-wasi": "0.28.5"
|
|
114
114
|
}
|
|
115
115
|
}
|