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

couchdatastream

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdatastream

Couch Data Stream is a smart pagination for couchdb that emits several events for the requested data. Also includes self retry for those big couch databases that needs to re-compile their views.

  • 0.15.305-a
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

Couch Data Stream

Couch Data Stream is a smart pagination for couchdb that emits several events for the requested data. Also includes self retry for those big couch databases that needs to re-compile their views.

It does not include a couchdriver (maybe future TODO) and it must be passed. Couch Data Stream was designed to work with nano; see documentation on how to use nano.

##Usage

couchdatastream = require('couchdatastream');

couchdatastream.displayLogs = false //optional

nano = require('nano');

var couchdb = nano('Your_Couch_Uri');
var targetDatabase = couchdb.use('Target_Database_Name');


paginator = new couchdatastream.ViewPaginator(
	targetDatabase,
	{
		_design : 'your_design_doc',
		_view   : 'your_view'
	},
	{
		startkey     : [],
		endkey       : [],
		limit        : <integer>,
		include_docs : <bool>
		reduce       : <bool>
	}
)

paginator.on('rows',function(rows){
	//Do something with your results

	paginator.next();
});

paginator.on('error',function(err){
	//Handle here the error

	paginator.end();
});

paginator.on('end',function(){
	//we are done here
});

//start the pagination
paginator.next();

##TODO

  • Add nano inside the package and require less things
  • Rewrite the code as coffeescript (maybe litcoffee)

##Changelog

###0.15.0305-a Fixed a problem with the statuscode on couchforce

###0.15.0218-a Added an option to display the internal logs while working. Default true.

###0.15.128-b Some info on the README was missing

###0.15.128-a Initial release, couchforce added to ViewPaginator routine

##Credits At no specific order

Keywords

FAQs

Package last updated on 05 Mar 2015

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