@oliphaunt/wasix-ts
v0.2.2
Published
Portable Oliphaunt WASIX TypeScript SDK for browsers, Node.js, Bun, Deno, and Electron.
Readme
Oliphaunt WASIX TypeScript SDK
Run PostgreSQL as WebAssembly in browsers, Node.js, Bun, Deno, or Electron. Use the Worker entrypoint in a browser to keep database execution off the UI thread.
Install
npm install @oliphaunt/wasix-tsBrowser Workers require cross-origin isolation. Follow the quickstart to configure the required response headers and bundler.
The quickstart covers prerequisites and the versions documented by the current site. Pin dependencies in your application manifest or lockfile.
First query
import Oliphaunt from '@oliphaunt/wasix-ts';
const db = await Oliphaunt.open();
try {
const result = await db.query('SELECT $1::int4 AS answer', [42]);
console.log(result.rows[0]?.answer); // 42
} finally {
await db.close();
}Default storage is a memory filesystem and is discarded on close. Use the quickstart's persistent-storage example for application data; run it as an alternative to this disposable example. Always close database handles explicitly.
Build your integration
- Guide: parameters, transactions, extensions, backups, and shutdown.
- API reference: methods, configuration, results, and errors.
- Runtime support: platforms, storage, and concurrency.
- Releases and upgrades: dependency and database upgrades.
