Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
pouchdb-hoodie-sync
Advanced tools
Hoodie-like sync API for PouchDB
This PouchDB plugin provides simple methods to keep two databases in sync.
// Initialisation
var db = new PouchDB('dbname')
var api = db.hoodieSync({
// remote can be
// - local db name
// - remote URL
// - PouchDB instance
// - a promise that resolves to one of the 3 above
remote: 'http://example.com/mydb',
// pass own EventEmitter instance if you want,
// otherwise creates its own
emitter: emitter
})
// starts / stops continuous replication
api.connect()
api.disconnect()
api.isConnected()
// resolve with pulled docs[]
api.pull()
api.pull([doc1, id2])
// resolve with pushed docs[]
api.push()
api.push([doc1, id2])
// resolve with synced docs[]
api.sync()
api.sync([doc1, id2])
// events
api.on('pull', function(doc) {})
api.on('push', function(doc) {})
api.on('connect', function() {})
api.on('disconnect', function() {})
If you need to customise the request to the server, e.g. set custom header for
authorisation, you can use PouchDB.defaults{ajax}
:
var MyPouch = PouchDB.defaults({
ajax: {
headers: {
authorization: 'Basic QWxhZGRpbjpPcGVuU2VzYW1l'
}
}
})
<script src="pouchdb.js"></script>
<script src="pouchdb-hoodie-sync.js"></script>
var PouchDB = require('pouchdb')
PouchDB.plugin( require('pouchdb-hoodie-sync') )
Run all tests and validates JavaScript Code Style using standard
npm test
To run only the tests
npm run test:node
Run tests from single file
node test/unit/connect-test.js
Have a look at the Hoodie project's contribution guidelines. If you want to hang out you can join #hoodie-pouch on our Hoodie Community Slack.
FAQs
Hoodie-like sync API for PouchDB
We found that pouchdb-hoodie-sync demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.