Skip to main content

Deno SQLite Module

test status docs status deno doc playground

This is an SQLite module for JavaScript. The wrapper is targeted at Deno and uses a version of SQLite3 compiled to WebAssembly (WASM). This module focuses on performance and ease of use.

While this module guarantees API compatibility according to semantic versioning, it has not been extensively tested in production. Please open issues (and if possible pull requests) for any problems you encounter. Regarding API compatibility also note this issue.

Documentation

Documentation is available as a website or in the docs folder.

Example

Also try the experimental web playground!

import { DB } from "https://deno.land/x/sqlite/mod.ts";

// Open a database
const db = new DB("test.db");
db.query("CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)");

const names = ["Peter Parker", "Clark Kent", "Bruce Wayne"];

// Run a simple query
for (const name of names)
  db.query("INSERT INTO people (name) VALUES (?)", [name]);

// Print out data in table
for (const [name] of db.query("SELECT name FROM people"))
  console.log(name);

// Close connection
db.close();