Skip to content

Commit ee4fc4d

Browse files
committed
fix SQLiteBlob.md
1 parent 281d4de commit ee4fc4d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/SQLiteBlob.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
<p align="center">
55
Capacitor community plugin for Native and Electron SQLite Databases. For <strong>Native</strong> and <strong>Electron</strong> platforms, databases could be encrypted with SQLCipher</p>
66

7+
## Prerequisite
8+
9+
```bash
10+
npm i --save buffer
11+
```
12+
713
## Read a SQLite Blob
814

915
### Image Blob
1016

1117
```js
18+
...
19+
import { Buffer } from 'buffer';
1220
...
1321
const stmt = `SELECT id, name, img FROM testblob;`;
1422
const ret: DBSQLiteValues = await db.query(stmt, []);
@@ -44,6 +52,8 @@
4452
### Text Blob
4553

4654
```js
55+
...
56+
import { Buffer } from 'buffer';
4757
...
4858
const stmt = `SELECT id, name, blobtext FROM teach;`;
4959
const bufText = Buffer.from(ret.values[0].blobtext);
@@ -57,6 +67,8 @@
5767
### Image Blob
5868

5969
```js
70+
...
71+
import { Buffer } from 'buffer';
6072
...
6173
const imagePath = "YOUR_IMAGE_PATH/favicon.png";
6274
const blob = await(await fetch(imagePath)).blob();
@@ -70,6 +82,8 @@
7082
### Text Blob
7183

7284
```js
85+
...
86+
import { Buffer } from 'buffer';
7387
...
7488
const textBuffer = Buffer.from('Hello, World!');
7589
const stmt = "INSERT INTO teach (id, name, blobtext)VALUES( ?,?,?);";

0 commit comments

Comments
 (0)