Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
couchdb-iterator
Advanced tools
A fast and easy to ease CouchDB iterator for views and all documents.
$ npm install couchdb-iterator
.couchdbIterator(couchdbAddr, [view], iterator, [options])
Calls iterator
for all rows
of the database referenced by couchdbAddr
.
If view
is supplied, iterates only over the view's rows.
This library aims to be fast, therefore iteration happens concurrently. The iterator function can be async but beware that order is not guaranteed.
const couchdbIterator = require('couchdb-iterator');
// Iterate over all rows of a database
couchdbIterator('http://localhost:5984/my-db', 'my-designdoc/my-view', (row, index) => {
console.log(index, row.id, row.key, row.value);
// Do something with `row`; you may return a promise here
// The next bulk of rows will only be fetched when all the rows for the current page are handled
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
// Iterate over all rows of a view
couchdbIterator('http://localhost:5984/my-db', 'my-designdoc/my-view', (row, index) => {
console.log(index, row.id, row.key, row.value);
// Do something with `row`; you may return a promise here
// The next bulk of rows will only be fetched when all the rows for the current page are handled
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
The couchdbAddr
argument must be connection string with protocol, host, port and database path (e.g.: http://localhost:5984/my-db') or a nano instance.
The view
argument is a string in the form of designdoc/view
(e.g.: app/byUser); if omitted, all rows from the database will iterated.
Available options:
concurrency
: The concurrency in which the iterator
is called, defaults to 50
.nano
: Custom options to be used when creating the nano instance, defaults to null
.limit
, skip
, stale
, descending
, startkey
, startkey_docid
, endkey
, endkey_docid
, include_docs
and inclusive_end
(can be camelCased).All querying options have no default value, except for limit
which is 500
. Also, stale
is automatically set to ok
after the first iteration to further improve performance.
$ npm test
$ npm test-cov
to get coverage report
Released under the MIT License.
FAQs
A fast and easy to ease CouchDB iterator for views and all documents
The npm package couchdb-iterator receives a total of 57 weekly downloads. As such, couchdb-iterator popularity was classified as not popular.
We found that couchdb-iterator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.