Skip to content

Commit

Permalink
ADD RxStorage Filesystem Node
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Apr 25, 2023
1 parent 9a38894 commit 6f02f67
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# RxDB Changelog

<!-- CHANGELOG NEWEST -->

- ADD [Filesystem Node RxStorage](https://rxdb.info/rx-storage-filesystem-node.html)
<!-- ADD new changes here! -->

<!-- /CHANGELOG NEWEST -->
Expand Down
4 changes: 3 additions & 1 deletion config/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"declarationMap": false,
"stripInternal": true,
"noEmit": false,
"types": []
"types": [
"node"
]
},
"include": [
"../src"
Expand Down
2 changes: 1 addition & 1 deletion docs-src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
* [RxStorage IndexedDB](./rx-storage-indexeddb.md)
* [RxStorage OPFS](./rx-storage-opfs.md)
* [RxStorage SQLite](./rx-storage-sqlite.md)
* [RxStorage Filesystem Node](./rx-storage-filesystem-node.md)
* [RxStorage FoundationDB](./rx-storage-foundationdb.md)
* [RxStorage Worker](./rx-storage-worker.md)
* [RxStorage Shared Worker](./rx-storage-shared-worker.md)
Expand Down Expand Up @@ -134,7 +135,6 @@

* [LeaderElection](./leader-election.md)


* [Cleanup](./cleanup.md)

* [Backup](./backup.md)
Expand Down
Binary file modified docs-src/files/rx-storage-performance-node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions docs-src/rx-storage-filesystem-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Filesystem Node RxStorage

The Filesystem Node [RxStorage](./rx-storage.md) for RxDB is built on top of the [Node.js Filesystem API](https://nodejs.org/api/fs.html).
It stores data in plain json/txt files like any "normal" database does. It is a bit faster compared to the [SQLite storage](./rx-storage-sqlite.md) and its setup is less complex.
Using the same database folder in parallel with multiple Node.js processes is supported when you set `multiInstance: true` while creating the [RxDatabase](./rx-database.md).

**NOTICE: The Filesystem Node RxStorage is part of [RxDB Premium](https://rxdb.info/premium.html)**

<p align="center">
<img src="./files/rx-storage-performance-node.png" alt="RxStorage performance - Node.js" width="700" />
</p>


## Usage

```ts
import {
createRxDatabase
} from 'rxdb';
import { getRxStorageFilesystemNode } from 'rxdb-premium/plugins/storage-filesystem-node';

const myRxDatabase = await createRxDatabase({
name: 'exampledb',
storage: getRxStorageFilesystemNode({
basePath: path.join(__dirname, 'my-database-folder'),
/**
* Set inWorker=true if you use this RxStorage
* together with the WebWorker plugin.
*/
inWorker: false
})
});
/* ... */
```
7 changes: 6 additions & 1 deletion docs-src/rx-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ The OPFS `RxStorage` is based on the File System Access API. This has the best p

### SQLite [[premium](https://rxdb.info/premium.html)]

The SQLite storage has the best performance when RxDB is used on **Node.js**, **Electron**, **React Native**, **Cordova** or **Capacitor**. [Read more](./rx-storage-sqlite.md)
The SQLite storage has great performance when RxDB is used on **Node.js**, **Electron**, **React Native**, **Cordova** or **Capacitor**. [Read more](./rx-storage-sqlite.md)

### Filesystem Node [[premium](https://rxdb.info/premium.html)]

The Filesystem Node storage is best suited when you use RxDB in a Node.js process or with [electron.js](./electron.md). [Read more](./rx-storage-filesystem-node.md)


### FoundationDB

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export type {
WithAttachmentsData,
RxTestStorage,
ById,
MaybePromise,
RxQueryPlan,
PlainJsonError,
CompressionMode
Expand Down

0 comments on commit 6f02f67

Please sign in to comment.