@wranggle/storage-node
This @wranggle/storage-node package bundles the main feature layers and persistence adapters used in an Electron or Node environment.
This page is dedicated to installation/setup. See the main WranggleStorage documentation for additional instructions.
Setup
Installation
-
Add the @wranggle/storage-node package to your project:
# From the command line using yarn: yarn add @wranggle/storage-node # or with npm: npm install @wranggle/storage-node
-
In your JavaScript, import or require WranggleStorage:
import { WranggleStorage } from '@wranggle/storage-node'; // or: const { WranggleStorage } = require('@wranggle/storage-node');
Alternatively, you can install and use just the persistence adapter and feature layers needed. (See individual package instructions.)
Create your store
Make sure your persistence library is available.
To use the sindresorhus/conf library for persistence, saving data in a json file, you can use the conf
shortcut to specify you want the ConfigFileAdapter adapter. Eg:
const conf = new Conf(myConfOpts);
const store = new WranggleStorage({ conf });
See the ConfigFileAdapter instructions for its configuration options.
Next Steps
Next, you'll want to add some feature layers. See the main WranggleStorage documentation for instructions.