Registry / database / sqlite-view

sqlite-view

JSON →
library0.2.0jsnpmunverified

sqlite-view 0.2.0 is a JavaScript library for building SQLite database readers in web applications. It emerged as an abstraction of the popular sqlite-viewer application, providing an embeddable component that can load and display SQLite databases directly in the browser. The library uses sql.js (SQLite compiled to WebAssembly) under the hood. Current release cadence is infrequent; the last release was in 2021. It differentiates by offering a simple, no-framework-required widget with support for loading databases via URL or ByteArray, and includes client-side XSS protection for database contents. However, it does not escape table names, which could lead to SQL injection from malicious databases.

npm install sqlite-view
INSTALL
IMPORT
SIG · SQLITE-VIEW
S
sqlite-view
databasejavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SqliteView
import SqliteView from 'sqlite-view'
const SqliteView = require('sqlite-view')
Package is ESM-only; CommonJS require() will fail. Use import or load via script tag.
SqliteView
import SqliteView from 'https://unpkg.com/sqlite-view/sqlite-view.js'
import SqliteView from 'https://unpkg.com/sqlite-view/index.js'
Unpkg path must include the built file sqlite-view.js.
SqliteView
<script type="module">import SqliteView from 'sqlite-view'
<script src="node_modules/sqlite-view/dist/index.js"></script>
No dist/ folder; use ESM import with bundler.

Shows how to embed a SQLite database viewer in an HTML page using a CDN import and load a sample database.

<div id="sqlite-viewer"></div> <script type="module"> import SqliteView from 'https://unpkg.com/sqlite-view/sqlite-view.js'; const viewer = new SqliteView('sqlite-viewer'); viewer.load( 'https://ryneeverett.gitlab.io/sqlite-view/sqlite-viewer/examples/Chinook_Sqlite.sqlite', ); </script>
Debug
Known issues
gotchaTable names are not escaped, allowing potential SQL injection from malicious database files. Loading untrusted databases is not recommended.
fix
Do not load untrusted databases; sanitize table names manually if needed.
affects: >=0.0.0
gotchaPackage is ESM-only; CommonJS require() will throw Module not found.
fix
Use import statement instead of require().
affects: >=0.0.0
deprecatedThe package has not been updated since 2021 and may use outdated dependencies.
fix
Consider forking or migrating to an actively maintained alternative like sql.js-based custom component.
affects: >=0.0.0
gotchaWhen loading from a URL, CORS must be enabled on the server; otherwise fetch will fail.
fix
Use a proxy server or host the database on the same origin.
affects: >=0.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'sqlite-view'
CommonJS require() used instead of ES module import.
fix
Change to `import SqliteView from 'sqlite-view'` and ensure package.json has type: module.
Uncaught TypeError: SqliteView is not a constructor
Incorrect import path or module evaluation order.
fix
Use `import SqliteView from 'sqlite-view'` (default export) and ensure it is loaded as a module.
Failed to load database: TypeError: Failed to fetch
CORS issue when loading database from a different origin.
fix
Serve the database file from the same origin or configure CORS headers.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
sql.jsrequiredUnderlying SQLite engine compiled to WebAssembly, used for executing SQL queries in the browser
Agent activity
16 hits · last 30 days
node
12
Meta
2
Amazon
1
OpenAI (training)
1
Resources