property

SQL.SQLiteOptions.filename

filename?: URL | string & {} | ':memory:'

Path to the database file

Examples:

  • sqlite://:memory:
  • sqlite://./path/to/database.db
  • sqlite:///Users/bun/projects/my-app/database.db
  • ./dev.db
  • :memory:

Everything from the first ? is a query string, which can have mode=: ro (read-only), rw (read-write, the file must exist) or rwc (read-write and create, the default). memory has no effect, and any other mode throws. The readonly and create options take priority over it, and a read-only database ignores create and readwrite.

Without a filename, Bun reads a DATABASE_URL that is not a PostgreSQL, MySQL or MariaDB URL, then SQLITE_URL.