API reference › @evolu/sqlite-wasm › SqliteVfsPath

const SqliteVfsPath: BrandType<
  Type<
    "String",
    string,
    string,
    TypeOfError<"String">,
    null,
    TypeOfError<"String">,
    never,
    string,
    true
  >,
  "SqliteVfsPath",
  SqliteVfsPathError
>;

Defined in: packages/sqlite-wasm/src/Database.ts:707

The canonical path of a database file on a SahPool, such as /evolu1.db, one spelling per file, as SahPool.getPaths lists it.

A path is canonical when it is its own new URL(path, "file://localhost/").pathname, the path a pool maps a name to, so the pool opens, lists and deletes the file by the path the database opened it with. A canonical path starts with / and is printable ASCII without ? or #, so SQLite passes it to the VFS as it is, and the paths SQLite derives from it by appending a suffix, as for the journal, are canonical too. It rejects:

  • Another spelling of a path, such as evolu1.db, /x/../evolu1.db, FILE:evolu1.db or /a b.db for /a%20b.db, and a name with a scheme, such as db:evolu1.db, which a pool would map to the relative path evolu1.db.
  • A path SQLite reads itself: an empty path and :memory:, which open an in-memory database, :localStorage: and :sessionStorage:, which SQLite opens on its kvvfs, and a file: URI, whose query and fragment SQLite strips and whose escapes it decodes, so the pool would get another name, and whose vfs parameter could name another VFS.
  • A path longer than sahPoolMaxDatabasePathSize, 498 bytes, because a pool slot's header holds a path of up to 510 bytes, and SQLite names a super-journal by appending 12 bytes to the database's path.