←back to thread

306 points emschwartz | 1 comments | | HN request time: 0s | source
Show context
zackify ◴[] No.46237465[source]
This is great... just got it working using bun:sqlite! Just need to have "LITESTREAM_REPLICA_URL" and the key id and secret env vars set when running the script.

  import { Database } from "bun:sqlite";
  Database.setCustomSQLite("/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib");

  // Load extension first with a temp db
  const temp = new Database(":memory:");
  temp.loadExtension("/path/to/litestream.dylib", "sqlite3_litestreamvfs_init");

  // Now open with litestream VFS
  const db = new Database("file:my.db?vfs=litestream");

  const fruits = db.query("SELECT * FROM fruits;").all();
  console.log(fruits);
replies(3): >>46238807 #>>46240074 #>>46240209 #
seigel ◴[] No.46238807[source]
Cool that you got this to work! How did you get the "dylib" location or file.
replies(2): >>46239364 #>>46239832 #
1. zackify ◴[] No.46239832[source]
The litestream one, from the litestream github releases page!