Registry / database / gbz-base

gbz-base

JSON →
library0.1.0-alpha.1jsnpmunverified

A prototype for storing a GBZ pangenome graph in an SQLite database, enabling interactive applications that need immediate access to parts of the graph without full in-memory loading. Currently at version 0.1.0-alpha.1, pre-stable. Key differentiators: uses SQLite for direct querying of graph slices, targets WASM for browser usage, and is intended to become an optional feature of GBWT-rs once stabilized. Released via npm as .wasm files, no JavaScript wrapper included.

npm install gbz-base
INSTALL
IMPORT
SIG · GBZ-BASE
G
gbz-base
databasejavascriptv0.1.0-alpha.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gbz2db.wasm
✓ const gbz2db = await import('gbz-base/gbz2db.wasm')
Webpack resolves .wasm imports and exports a URL as default. Use dynamic import in browser environments.
query.wasm
✓ const query = await import('gbz-base/query.wasm')
Same as gbz2db.wasm. The .wasm files are WASI modules, not ES modules; need a WASI shim to execute.
full path for Node.js
✓ const fs = require('fs'); const wasm = fs.readFileSync(require.resolve('gbz-base/target/wasm32-wasi/release/query.wasm'))
✗ const query = require('gbz-base/query.wasm')
Node cannot import or require .wasm files directly. Must read the file from its actual filesystem path under node_modules.

Demonstrates loading query.wasm in the browser using dynamic import and browser-wasi-shim for WASI syscalls.

// Browser quickstart with browser-wasi-shim import { WASI, File, OpenFile, ConsoleStdout } from 'browser-wasi-shim'; // Fetch the WASM module const queryUrl = await import('gbz-base/query.wasm'); const response = await fetch(queryUrl.default); const wasmBytes = await response.arrayBuffer(); // Set up a WASI instance with a virtual filesystem const fds = [ new OpenFile(new File([])), // stdin ConsoleStdout(), ConsoleStdout(), ]; const wasi = new WASI([], [], fds); // Instantiate the WebAssembly module const { instance } = await WebAssembly.instantiate(wasmBytes, { wasi_snapshot_preview1: wasi.wasiImport, }); wasi.start(instance); // Query the graph with example graph 'example.gbz' // Note: actual usage requires passing arguments and files
Debug
Known issues
breakingVersion 0.x: API not stable. Breaking changes possible at any time.
fix
Pin to exact version and expect manual migration.
affects: <1.0.0
deprecatedPre-alpha state: No JavaScript helper or loader provided; user must handle .wasm loading manually.
fix
Use your own loader or wait for stable release with bundled JS.
affects: >=0.1.0-alpha.1
gotchaNode.js cannot import or require .wasm files as modules. Using `require('gbz-base/query.wasm')` will fail.
fix
Read the .wasm file from its actual path: require.resolve('gbz-base/target/wasm32-wasi/release/query.wasm')
affects: all
gotchaThe .wasm files target WASI, not bare WebAssembly. They need a WASI shim in non-WASI runtimes (browser, Node without --experimental-wasi-unstable).
fix
Use a WASI implementation like browser-wasi-shim or Node's built-in WASI (experimental).
affects: all
Errors
Common errors & fixes
Cannot find module 'gbz-base/query.wasm'
Wrong import path for the .wasm file.
fix
Use dynamic import with full path if using Webpack: await import('gbz-base/query.wasm')
TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object
Missing WASI import object when instantiating the .wasm module outside a WASM runtime.
fix
Provide a valid wasi_snapshot_preview1 import object, e.g., from browser-wasi-shim.
Error: The module 'gbz-base/query.wasm' cannot be imported because it's not an ES Module
Trying to use `import` statement on a .wasm file in Node.js without proper loader.
fix
Read the .wasm file with fs.readFileSync and compile it manually.
Upgrade
Version history
0.1.0-alpha.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
gbz-base — npm install gbz-base · libregistry