https://github.com/kanaverse/valkana
Validating the kana state files
https://github.com/kanaverse/valkana
Last synced: 2 months ago
JSON representation
Validating the kana state files
- Host: GitHub
- URL: https://github.com/kanaverse/valkana
- Owner: kanaverse
- Created: 2022-07-08T00:04:32.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-01T05:45:47.000Z (over 2 years ago)
- Last Synced: 2024-04-24T13:16:33.729Z (12 months ago)
- Language: JavaScript
- Size: 880 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Validating kana state files
## Overview
This package is a wrapper for the [**kanaval** C++ library](https://github.com/LTLA/kanaval) for validating the HDF5 state files produced by [**bakana**](https://github.com/LTLA/bakana).
It is primarily used for **bakana**'s unit testing, to check that the parameters and results are correctly serialized.
We created a separate package rather than attempting to bundle the Wasm files inside **bakana** (or **scran.js**) where they would bloat the production bundles.## Quick start
We assume that the `*.kana` file has been parsed to obtain the embedded HDF5 file, e.g., using **bakana**'s `parseKanaFile()` function.
Then, given a path to the state file, we can just do:```js
import * as va from "valkana";
await va.initialize();
va.validateState(
path, /* path to a state file */
true, /* embedded or linked */
2001000 /* kana file version */
);
```This will raise an error if the state file does not satisfy the [specification](https://github.com/LTLA/kanaval).
Web applications will need to make sure that the HDF5 file is saved on **valkana**'s virtual filesystem via the `writeFile()` function.
See the [reference documentation](https://ltla.github.io/valkana) for more details.## Developer notes
This package compiles the **kanaval** library to WebAssembly for execution in typical Javascript environments (e.g., browser/Node.js).
Building the Wasm binary requires the [Emscripten toolchain](https://emscripten.org) and a recent version of [CMake](https://cmake.org).
Once these are installed, we can simply do:```sh
./build.sh main
./build.sh browser
```Testing can be done with `npm run test` on Node 16+.