{"id":45010,"library":"gbz-base","title":"gbz-base: GBZ pangenome graph in SQLite","description":"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.","status":"active","version":"0.1.0-alpha.1","language":"javascript","source_language":"en","source_url":"https://github.com/jltsiren/gbz-base","tags":["javascript"],"install":[{"cmd":"npm install gbz-base","lang":"bash","label":"npm"},{"cmd":"yarn add gbz-base","lang":"bash","label":"yarn"},{"cmd":"pnpm add gbz-base","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Webpack resolves .wasm imports and exports a URL as default. Use dynamic import in browser environments.","wrong":"","symbol":"gbz2db.wasm","correct":"const gbz2db = await import('gbz-base/gbz2db.wasm')"},{"note":"Same as gbz2db.wasm. The .wasm files are WASI modules, not ES modules; need a WASI shim to execute.","wrong":"","symbol":"query.wasm","correct":"const query = await import('gbz-base/query.wasm')"},{"note":"Node cannot import or require .wasm files directly. Must read the file from its actual filesystem path under node_modules.","wrong":"const query = require('gbz-base/query.wasm')","symbol":"full path for Node.js","correct":"const fs = require('fs'); const wasm = fs.readFileSync(require.resolve('gbz-base/target/wasm32-wasi/release/query.wasm'))"}],"quickstart":{"code":"// Browser quickstart with browser-wasi-shim\nimport { WASI, File, OpenFile, ConsoleStdout } from 'browser-wasi-shim';\n\n// Fetch the WASM module\nconst queryUrl = await import('gbz-base/query.wasm');\nconst response = await fetch(queryUrl.default);\nconst wasmBytes = await response.arrayBuffer();\n\n// Set up a WASI instance with a virtual filesystem\nconst fds = [\n  new OpenFile(new File([])), // stdin\n  ConsoleStdout(),\n  ConsoleStdout(),\n];\nconst wasi = new WASI([], [], fds);\n\n// Instantiate the WebAssembly module\nconst { instance } = await WebAssembly.instantiate(wasmBytes, {\n  wasi_snapshot_preview1: wasi.wasiImport,\n});\nwasi.start(instance);\n\n// Query the graph with example graph 'example.gbz'\n// Note: actual usage requires passing arguments and files","lang":"javascript","description":"Demonstrates loading query.wasm in the browser using dynamic import and browser-wasi-shim for WASI syscalls."},"warnings":[{"fix":"Pin to exact version and expect manual migration.","message":"Version 0.x: API not stable. Breaking changes possible at any time.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use your own loader or wait for stable release with bundled JS.","message":"Pre-alpha state: No JavaScript helper or loader provided; user must handle .wasm loading manually.","severity":"deprecated","affected_versions":">=0.1.0-alpha.1"},{"fix":"Read the .wasm file from its actual path: require.resolve('gbz-base/target/wasm32-wasi/release/query.wasm')","message":"Node.js cannot import or require .wasm files as modules. Using `require('gbz-base/query.wasm')` will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Use a WASI implementation like browser-wasi-shim or Node's built-in WASI (experimental).","message":"The .wasm files target WASI, not bare WebAssembly. They need a WASI shim in non-WASI runtimes (browser, Node without --experimental-wasi-unstable).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.1.0':42 'access':27 'alpha.1':43 'applic':23 'base':3 'becom':66 'browser':60 'current':39 'databas':20 'differenti':48 'direct':52 'enabl':21 'featur':69 'file':81 'full':34 'gbwt':72 'gbwt-rs':71 'gbz':2,4,14 'gbz-base':1 'graph':6,16,32,55 'immedi':26 'in-memori':35 'includ':85 'intend':64 'interact':22 'javascript':83,86 'key':47 'load':38 'memori':37 'need':25 'npm':78 'option':68 'pangenom':5,15 'part':29 'pre':45 'pre-stabl':44 'prototyp':10 'queri':53 'releas':76 'rs':73 'slice':56 'sqlite':8,19,50 'stabil':75 'stabl':46 'store':12 'target':57 'usag':61 'use':49 'version':41 'via':77 'wasm':58,80 'without':33 'wrapper':84","created_at":"2026-06-07T12:52:55.963443+00:00","updated_at":"2026-06-07T12:52:55.963443+00:00","problems":[{"fix":"Use dynamic import with full path if using Webpack: await import('gbz-base/query.wasm')","cause":"Wrong import path for the .wasm file.","error":"Cannot find module 'gbz-base/query.wasm'"},{"fix":"Provide a valid wasi_snapshot_preview1 import object, e.g., from browser-wasi-shim.","cause":"Missing WASI import object when instantiating the .wasm module outside a WASM runtime.","error":"TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object"},{"fix":"Read the .wasm file with fs.readFileSync and compile it manually.","cause":"Trying to use `import` statement on a .wasm file in Node.js without proper loader.","error":"Error: The module 'gbz-base/query.wasm' cannot be imported because it's not an ES Module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jltsiren/gbz-base","github":"https://github.com/jltsiren/gbz-base","docs":null,"changelog":null,"pypi":null,"npm":"gbz-base","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}