UNPKG

@e2fyi/streams

Version:

Nodejs stream library for various use cases: e.g. Auto-tagging object streams, streaming to mongoDb via mongoose models, etc.

556 lines (190 loc) 8.81 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Module: @e2fyi/streams</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Module: @e2fyi/streams</h1> <section> <header> </header> <article> <div class="container-overview"> </div> <h3 class="subsection-title">Classes</h3> <dl> <dt><a href="module-@e2fyi_streams.DocumentTagger.html">DocumentTagger</a></dt> <dd></dd> <dt><a href="module-@e2fyi_streams.MongooseStream.html">MongooseStream</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Type Definitions</h3> <h4 class="name" id=".DocumentTaggerSettings">DocumentTaggerSettings</h4> <div class="description"> <p>Settings for DocumentTagger.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>autoIncrement</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>The auto-increment field to tag onto the stream object.</p></td> </tr> <tr> <td class="name"><code>ignoreNonObject</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If <code>true</code>, no errors will be emitted when the chunk in the stream cannot be parsed into <code>Object</code>.</p></td> </tr> <tr> <td class="name"><code>readableObjectMode</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If <code>true</code>, <code>Object</code> will be emitted from the stream, otherwise a <code>String</code> or <code>Buffer</code> representation or will emitted instead.</p></td> </tr> <tr> <td class="name"><code>objectMode</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If <code>true</code>, <code>Object</code> will be emitted from the stream, otherwise a <code>String</code> or <code>Buffer</code> representation or will emitted instead. Overwrites <code>writableObjectMode</code>.</p></td> </tr> <tr> <td class="name"><code>filter</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>Function to filter the objects in the stream. Return <code>true</code> to keep the object.</p></td> </tr> <tr> <td class="name"><code>mutate</code></td> <td class="type"> <span class="param-type">function</span> | <span class="param-type">Object</span> </td> <td class="description last"><p>Function or Object to mutate the stream. If an Object is provided, each stream object will be mutated with the <code>Object.assign(streamObj, mutateObj)</code>.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_document-tagger.js.html">src/document-tagger.js</a>, <a href="src_document-tagger.js.html#line5">line 5</a> </li></ul></dd> </dl> <h4 class="name" id=".MongooseStreamSettings">MongooseStreamSettings</h4> <div class="description"> <p>Settings for MongooseStream.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>itemWaterMark</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 50 </td> <td class="description last"><p>The number of item collected before writing to mongodb.</p></td> </tr> <tr> <td class="name"><code>passThrough</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>If <code>false</code> nothing will be emitted from the stream.</p></td> </tr> <tr> <td class="name"><code>model</code></td> <td class="type"> <span class="param-type">mongoose.Model</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p><a href="http://mongoosejs.com/docs/models.html">mongoose Model</a>.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_mongoose-stream.js.html">src/mongoose-stream.js</a>, <a href="src_mongoose-stream.js.html#line5">line 5</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@e2fyi_streams.html">@e2fyi/streams</a></li></ul><h3>Classes</h3><ul><li><a href="module-@e2fyi_streams.DocumentTagger.html">DocumentTagger</a></li><li><a href="module-@e2fyi_streams.MongooseStream.html">MongooseStream</a></li></ul><h3>Events</h3><ul><li><a href="DocumentTagger.html#event:filtered">filtered</a></li><li><a href="MongooseStream.html#event:mongoose-bulk-write">mongoose-bulk-write</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.0</a> on Thu Dec 14 2017 18:22:08 GMT+0800 (+08) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>