Deno SQLite3
The fastest and correct module for SQLite3 in Deno.
Example
import { Database } from "jsr:@db/sqlite@0.11";
const db = new Database("test.db");
const [version] = db.prepare("select sqlite_version()").value<[string]>()!;
console.log(version);
db.close();
Usage
Since this library depends on the unstable FFI API, you must pass --allow-env
,
--allow-ffi
and --unstable-ffi
flags. Network and FS permissions are also
needed to download and cache prebuilt library.
You can also just use --allow-all
/ -A
flag since FFI basically gives full
access.
deno run -A --unstable-ffi <file>
Benchmark
Benchmark based on just-js/02-sqlite
See bench for benchmarks source.
Documentation
See doc.md for documentation.
Check out the complete API reference here.
Native Library
It will download and cache a prebuilt shared library from GitHub releases, for which it will need network and file system read/write permission.
If you want to use custom library, then you can set the DENO_SQLITE_PATH
environment variable, to a fully specified path to the SQLite3 shared library.
Contributing
Code is formatted using deno fmt
and linted using deno lint
. Please make
sure to run these commands before committing.
You can optionally build sqlite3 from source. Make sure that you have the
submodule (git submodule update --init --recursive
).
deno task build
When running tests and benchmarks, you use the DENO_SQLITE_LOCAL=1
env
variable otherwise it won't use to locally compiled SQLite library.
DENO_SQLITE_LOCAL=1 deno task bench
Related
- x/sqlite, WASM based.
License
Apache-2.0. Check LICENSE for details.
Copyright © 2023 DjDeveloperr