Socket
Socket
Sign inDemoInstall

@aveq-research/localforage-asyncstorage-driver

Package Overview
Dependencies
0
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aveq-research/localforage-asyncstorage-driver

[![npm version](https://badge.fury.io/js/%40aveq-research%2Flocalforage-asyncstorage-driver.svg)](https://badge.fury.io/js/%40aveq-research%2Flocalforage-asyncstorage-driver)


Version published
Weekly downloads
850
decreased by-3.74%
Maintainers
2
Install size
21.6 kB
Created
Weekly downloads
 

Readme

Source

localforage-asyncstorage-driver

npm version

This Library contains a driver which enables to use localforage for React-Native's AsyncStorage.

Peer Dependencies

Please note! With the switch to v3.0.0 @react-native-async-storage/async-storage became a peer dependency!!

Setup

Simply install the driver via NPM:

npm i --save @aveq-research/localforage-asyncstorage-driver

If not done yet, make sure to have the appropriate peer dependencies (react resp. react-native) to be installed.

Usage

It delivers three different methods to create an appropriate driver:

  • driverWithoutSerialization(): Create a common AsyncStorage driver which does not serialize any data automatically; you need to integrate your own serialization!
  • driverWithSerialization(serializer): Creates an AsyncStorage driver with the given serializer; A valid serializer needs to contain a serialize and deserialize method
  • driverWithDefaultSerialization(): Will use the default serialization from localforage

Working Code Example:

import { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';

const driver = driverWithoutSerialization();
await localforage.defineDriver(driver);
await localforage.setDriver(driver._driver); // i.e. "rnAsyncStorageWrapper"

Alternatively with instance usage:

import { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';

const driver = driverWithoutSerialization();
const instance = localforage.createInstance({ driver });

After that you may use localforage as you know it already. For further questions concerning the localforage API, lookup https://github.com/localForage/localForage

License

This driver is distributed under MIT License (see LICENSE) and maintained by the wonderful AVEQ team.

FAQs

Last updated on 31 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc