{"id":46439,"library":"sql.js-httpvfs","title":"sql.js-httpvfs","description":"sql.js-httpvfs (v0.8.12) is a read-only HTTP-Range-request based virtual file system for SQLite in the browser. It wraps sql.js to allow querying SQLite databases hosted on static file hosts without full download. Key differentiators: enables client-side SQL queries on large databases with lazy loading via HTTP range requests, includes a DOM virtual table proof-of-concept, and supports splitting databases into chunks for CDN caching. Works well with proper indexing and page size tuning. Low release cadence; last update was 2024.","status":"active","version":"0.8.12","language":"javascript","source_language":"en","source_url":"https://github.com/phiresky/sql.js-httpvfs","tags":["javascript"],"install":[{"cmd":"npm install sql.js-httpvfs","lang":"bash","label":"npm"},{"cmd":"yarn add sql.js-httpvfs","lang":"bash","label":"yarn"},{"cmd":"pnpm add sql.js-httpvfs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core SQLite compilation via Emscripten; sql.js-httpvfs is a wrapper around it.","package":"sql.js","optional":false}],"imports":[{"note":"ESM-only; CommonJS require works but may have issues with default exports. Use named import for tree shaking.","wrong":"const createDbWorker = require('sql.js-httpvfs').createDbWorker","symbol":"createDbWorker","correct":"import { createDbWorker } from 'sql.js-httpvfs'"},{"note":"Default export is the module itself; named exports are preferred. Use createDbWorker directly.","wrong":"const sqlJsHttpVfs = require('sql.js-httpvfs')","symbol":"default","correct":"import sqlJsHttpVfs from 'sql.js-httpvfs'"},{"note":"TypeScript users should import types separately; ImportedConfig defines the config shape.","wrong":"","symbol":"type ImportedConfig","correct":"import type { ImportedConfig } from 'sql.js-httpvfs'"},{"note":"Config is an alias for the inline configuration object; use for type checking.","wrong":"","symbol":"type Config","correct":"import type { Config } from 'sql.js-httpvfs'"}],"quickstart":{"code":"import { createDbWorker } from 'sql.js-httpvfs';\n\nconst workerUrl = new URL('sql.js-httpvfs/dist/sqlite.worker.js', import.meta.url);\nconst wasmUrl = new URL('sql.js-httpvfs/dist/sql-wasm.wasm', import.meta.url);\n\nconst config = {\n  from: 'inline',\n  config: {\n    serverMode: 'full',\n    requestChunkSize: 4096,\n    url: '/foo/bar/test.sqlite3'\n  }\n};\n\nlet maxBytesToRead = 10 * 1024 * 1024;\nconst worker = await createDbWorker(\n  [config],\n  workerUrl.toString(),\n  wasmUrl.toString(),\n  maxBytesToRead\n);\n\nconst result = await worker.db.exec('SELECT * FROM table WHERE id = ?', [123]);\nconsole.log(result);","lang":"typescript","description":"Initialize a worker with an inline config pointing to a SQLite file, then run a parameterized SELECT query."},"warnings":[{"fix":"Use new URL() with import.meta.url or configure bundler to include sql.js-httpvfs/dist/* files.","message":"Worker and WASM URLs must be resolved at build time. Using relative paths may fail in production if bundler doesn't copy assets.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Run PRAGMA page_size=1024; VACUUM; on your SQLite database before hosting.","message":"Database must be structured for range requests: use page_size=1024 and proper indexes. Without optimization, performance is poor.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set maxBytesToRead to at least 10MB or Infinity for full database access.","message":"maxBytesToRead limits total bytes fetched. If set too low (e.g., <10MB), queries may fail with 'out of memory' or incomplete data.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Update config to use { from: 'inline', config: { ... } } instead of passing url directly.","message":"In v0.8.0, the config object format changed. 'from' field now expects 'inline' or 'jsonconfig' instead of direct url.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Always pass wasmUrl.toString() as third argument.","message":"createDbWorker's signature changed: third argument (wasmUrl) is now required; previously it was optional and defaulted to a bundled path.","severity":"deprecated","affected_versions":"<0.8.0"},{"fix":"Use file-loader or copy-webpack-plugin to manually copy dist files and reference them with a string URL.","message":"If using with a bundler that doesn't support import.meta.url (e.g., older webpack), worker/wasm URLs may be undefined.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'2024':91 'allow':28 'base':15 'browser':23 'cach':75 'cadenc':87 'cdn':74 'chunk':72 'client':44 'client-sid':43 'concept':66 'databas':31,50,70 'differenti':41 'dom':60 'download':39 'enabl':42 'file':17,35 'full':38 'host':32,36 'http':12,55 'http-range-request':11 'httpvfs':2,4 'includ':58 'index':80 'javascript':92 'key':40 'larg':49 'last':88 'lazi':52 'load':53 'low':85 'page':82 'proof':64 'proof-of-concept':63 'proper':79 'queri':29,47 'rang':13,56 'read':9 'read-on':8 'releas':86 'request':14,57 'side':45 'size':83 'split':69 'sql':46 'sql.js':1,3,26 'sqlite':20,30 'static':34 'support':68 'system':18 'tabl':62 'tune':84 'updat':89 'v0.8.12':5 'via':54 'virtual':16,61 'well':77 'without':37 'work':76 'wrap':25","created_at":"2026-06-07T12:59:56.028957+00:00","updated_at":"2026-06-07T12:59:56.028957+00:00","problems":[{"fix":"Use `import { createDbWorker } from 'sql.js-httpvfs'` (ESM) or ensure bundler is configured for ES modules.","cause":"Wrong import syntax or bundler not resolving named export.","error":"Uncaught (in promise) ReferenceError: createDbWorker is not defined"},{"fix":"Await the createDbWorker promise: `const worker = await createDbWorker(...)`.","cause":"Worker not fully initialized or db property accessed before promise resolves.","error":"TypeError: Cannot read properties of undefined (reading 'exec')"},{"fix":"Configure server to serve .wasm files with MIME type application/wasm or set Content-Type header.","cause":"WASM file served with incorrect MIME type (e.g., application/octet-stream).","error":"Failed to load wasm: Response has unsupported MIME type"},{"fix":"Add CORS headers to the server hosting the SQLite file, or serve it from the same origin.","cause":"Database file hosted on a different origin without CORS headers.","error":"Access to XMLHttpRequest at 'http://...' from origin 'null' has been blocked by CORS policy"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/phiresky/sql.js-httpvfs","github":"https://github.com/phiresky/sql.js-httpvfs","docs":null,"changelog":null,"pypi":null,"npm":"sql.js-httpvfs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}