Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-adapter-react-native-level

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-adapter-react-native-level

.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pouchdb-adapter-react-native-level

Minor modification on the existing PouchDB LevelDB adapter, mainly by updating the code to use a abstract-level compliant database (which is the successor to the now obsolete abstract-leveldown interface currently used by most projects).

Based on react-native-leveldb by GreenTriangle, wrapped through my abstract-level compliant adapter for it (react-native-leveldb-level-adapter)

Installation

npm install pouchdb-adapter-react-native-level

Usage

import PouchDB from 'pouchdb-core'
import HttpPouch from 'pouchdb-adapter-http'
import replication from 'pouchdb-replication'
import mapreduce from 'pouchdb-mapreduce'
import find from 'pouchdb-find'
import RNPouchAdapter from 'pouchdb-adapter-react-native-level';

// These imports and statements are used to shim global variables used by PouchDB
import 'fast-text-encoding';
import 'react-native-get-random-values';
import { btoa, atob } from 'react-native-quick-base64';
import { Buffer } from 'buffer';
if (!global.btoa) {
  global.btoa = btoa;
}
if (!global.atob) {
  global.atob = atob;
}
if (!global.Buffer) {
  global.Buffer = Buffer;
}

const Pouch = PouchDB.plugin(HttpPouch)
  .plugin(replication)
  .plugin(mapreduce)
  .plugin(find)
  .plugin(RNPouchAdapter)

const pouchdb = new Pouch('myDb');

const saveResult = await pouchdb.post({
    hello: 1,
    world: 3,
    _attachments: {
        'stuff': {
        content_type: 'application/json',
        data: 'aGVsbG93b3JsZA=='
        }
    }
})
const foundDocs = await pouchdb.find({
    selector: {
      hello: { $gte: 1 }
    },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Package last updated on 24 Jan 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc