Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Lightweight CouchDB CLI and Node API for efficient stream processing.
5984 is a set of a few specific tools. Chaining provides wide flexibility.
5984 batch -n 1000 docs.ndjson \
| 5984 fetch-revs mydb \
| 5984 batch -n 100 \
| 5984 bulk mydb
For now 5984 provides the following commands:
Please share your thoughts - what is important to you and where you'd see a good fit for it.
The commandline client handles Newline Delimited JSON, which is a perfect fit for CouchDB for many reasons. CouchDB also provides its continuous changes feed as ndjson.
npm install 5984 -g
You can feed the 5984 CLI either with ndjson files provided via commandline argument or via stdin:
5984 bulk mydb docs.ndjson
echo '{"_id": "mydoc"}' | 5984 bulk mydb
The Node API has a stream interface:
var fnef = require('5984')
var bulk = fnef.bulkDocs('mydb')
bulk.on('data', function (response) {
console.log(response)
})
bulk.write({ _id: 'mydoc' })
Documents can can be given using different formats:
Input chunk can be a single document object:
{ "_id": "one" }
...or an array of docs:
[
{ "_id": "one" },
{ "_id": "two" }
]
...or an object with a docs
property with an array of docs, like eg. used in
_bulk_docs
requests:
{
"docs": [
{ "_id": "one" },
{ "_id": "two" }
]
}
There are some global options:
options.url
: CouchDB server url (defaults to http://localhost:5984)options.username
: username to authenticate withoptions.password
: password to authenticate withCommands are invoked in a Git-style manner: 5984 <command> [options]
Run 5984
without an argument or 5984 help
for detailed CLI usage.
The API can be imported either as a whole or directly:
var fnef = require('5984')
var bulkDocs = require('5984/bulk-docs')
All API endpoints return a readable stream in object mode.
Post documents via _bulk_docs
to a CouchDB.
db
: database url. Can also be a database name, in which case the host from options.url
is used.Queries current revisions from database via _all_docs
request and inserts them
into the documents.
db
: database url. Can also be a database name, in which case the host from options.url
is used.Compile couchapp directories and CommonJS modules. See couchdb-compile for details.
Input is not ndjson but plain newline delimited filenames.
If source
is provided, use it as input rather than a stream of filenames.
source
: compile source file. Optional.options.index
: look for index.js
files. Default is false.Group documents to batches.
options.size
: batch size (default is 100)$ 5984 compile ./ddoc | 5984 fetch-revs mydb | 5984 bulk-docs mydb
{"ok":true,"id":"_design/myapp","rev":"1-967a00dff5e02add41819138abb3284d"}
5984 batch -n 1000 docs.ndjson \
| 5984 fetch-revs mydb \
| 5984 batch -n 100 \
| 5984 bulk mydb
First the input docs are batched into 1000er batches. For each batch a request is being made to retrieve current revisions of the documents. Now the docs are again batched, this time into 100er batches. These batches are posted to CouchDB.
Please also have a look at the tests.
Apache 2.0.
(c) 2016 Johannes J. Schmidt
FAQs
Lightweight CouchDB CLI and API for efficient stream processing.
The npm package 5984 receives a total of 10 weekly downloads. As such, 5984 popularity was classified as not popular.
We found that 5984 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.