You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sqlite-wasm/README.md
+33-25Lines changed: 33 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,23 @@
2
2
3
3
SQLite WASM conveniently wrapped as an ES Module. It includes the [sqlite-sync](https://github.com/sqliteai/sqlite-sync) and [sqlite-vector](https://github.com/sqliteai/sqlite-vector) extensions that are automatically loaded at runtime. TypeScript types are from the [official sqlite-wasm repository](https://github.com/sqlite/sqlite-wasm).
4
4
5
+
## Features
6
+
7
+
- 🚀 SQLite WASM wrapped as an ES Module
8
+
- 🔄 Includes sqlite-sync and sqlite-vector extensions
9
+
- 📝 Full TypeScript support
10
+
- 💾 OPFS (Origin Private File System) support for persistent storage
11
+
- ⚡ Worker thread support for better performance
12
+
5
13
## Installation
6
14
7
15
```bash
8
16
npm install @sqliteai/sqlite-wasm
9
17
```
10
18
11
-
## Vite Usage Example
19
+
## Vite Configuration
12
20
13
-
If you are using [vite](https://vitejs.dev/), you need to add the following
14
-
config option in `vite.config.js`:
21
+
If you are using [Vite](https://vitejs.dev/), you need to add the following configuration options to your `vite.config.js`:
15
22
16
23
```js
17
24
import { defineConfig } from'vite';
@@ -29,20 +36,19 @@ export default defineConfig({
29
36
});
30
37
```
31
38
32
-
Check out the [sport-tracker-app example](https://github.com/sqliteai/sqlite-sync/tree/main/examples/sport-tracker-app)that shows this in action while using SQLite WASM in a worker thread.
39
+
💡 **Example**: Check out the [sport-tracker-app example](https://github.com/sqliteai/sqlite-sync/tree/main/examples/sport-tracker-app)to see SQLite WASM in action with a worker thread implementation.
33
40
34
41
## Usage
35
42
36
-
There are three ways to use SQLite Wasm:
43
+
There are three ways to use SQLite WASM:
37
44
38
-
-[in the main thread with a wrapped worker](#in-a-wrapped-worker-with-opfs-if-available)
39
-
-[in a worker](#in-a-worker-with-opfs-if-available)
40
-
-[in the main thread](#in-the-main-thread-without-opfs) (⚠️ sqlite-sync does not work in the main thread)
45
+
1.**[Wrapped Worker](#wrapped-worker-with-opfs-support)** - Uses a wrapped worker (recommended)
46
+
2.**[Direct Worker](#direct-worker-with-opfs-support)** - Uses a direct worker implementation
47
+
3.**[Main Thread](#main-thread-without-opfs)** - Runs in the main thread ⚠️ *sqlite-sync does not work in the main thread*
41
48
42
-
Only the worker versions allow you to use the origin private file system (OPFS)
43
-
storage back-end.
49
+
> 💡 **Note**: Only the worker versions support the Origin Private File System (OPFS) storage backend for persistent data storage.
This project is based on [SQLite WASM](https://sqlite.org/wasm), which is conveniently wrapped as an ES Module and published to npm as [`@sqliteai/sqlite-wasm`](https://www.npmjs.com/package/@sqliteai/sqlite-wasm).
0 commit comments