{"_id":"checkpoint-stream","_rev":"6-55f6ac323f62e0a903e3be89fe01126c","name":"checkpoint-stream","description":"Queue data from a stream until a checkpoint is hit","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"checkpoint-stream","version":"0.1.0","description":"Queue data from a stream until a checkpoint is hit","main":"index.js","scripts":{"lint":"standard","test":"mocha *.test.js"},"keywords":["queue","stream","checkpoint"],"files":["index.js"],"author":{"name":"Stephen Sawchuk","email":"sawchuk@gmail.com"},"license":"MIT","devDependencies":{"async":"^2.1.4","mocha":"^3.2.0","standard":"^8.6.0"},"dependencies":{"events-intercept":"^2.0.0","pumpify":"^1.3.5","split-array-stream":"^1.0.0","through2":"^2.0.3"},"standard":{"global":["after","before","beforeEach","describe","it"]},"gitHead":"c8e50b5ccb3c5a42548865c6f63db9ef657a01e2","_id":"checkpoint-stream@0.1.0","_shasum":"4669c7b0ec659931a1ea8b720f9f30e5a832906a","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"stephenplusplus","email":"sawchuk@gmail.com"},"dist":{"shasum":"4669c7b0ec659931a1ea8b720f9f30e5a832906a","tarball":"https://registry.npmjs.org/checkpoint-stream/-/checkpoint-stream-0.1.0.tgz","integrity":"sha512-3vLjwKD0O+l8zsyBhFHdQitrkAA/yNOZL9jaqWVmXCgcfAnBK+YKhbzWMVPnsN5QyY/uBQxI3NxU9oEhoTAUUQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF72fAtQMc8wZ/PozvmJtxTxD0m+6y0COtv3sopuvBmgAiA2ijugAgYWO4TooVxMpxUCv1unBwvlud520zXYUYeouQ=="}]},"maintainers":[{"name":"stephenplusplus","email":"sawchuk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/checkpoint-stream-0.1.0.tgz_1482426129550_0.6830837407615036"},"directories":{}},"0.1.1":{"name":"checkpoint-stream","version":"0.1.1","description":"Queue data from a stream until a checkpoint is hit","main":"index.js","scripts":{"lint":"standard","test":"mocha *.test.js"},"keywords":["queue","stream","checkpoint"],"files":["index.js"],"author":{"name":"Stephen Sawchuk","email":"sawchuk@gmail.com"},"license":"MIT","devDependencies":{"async":"^2.1.4","mocha":"^3.2.0","standard":"^8.6.0"},"dependencies":{"events-intercept":"^2.0.0","pumpify":"^1.3.5","split-array-stream":"^1.0.0","through2":"^2.0.3"},"standard":{"global":["after","before","beforeEach","describe","it"]},"gitHead":"bf2f7ca35981d764462f1c696e10a24f271301b4","_id":"checkpoint-stream@0.1.1","_shasum":"59088511fbe23b6d2c1e82eaf02f28459667f637","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"stephenplusplus","email":"sawchuk@gmail.com"},"dist":{"shasum":"59088511fbe23b6d2c1e82eaf02f28459667f637","tarball":"https://registry.npmjs.org/checkpoint-stream/-/checkpoint-stream-0.1.1.tgz","integrity":"sha512-NrQ/as3Ymtixh3X/Em9mEzRTl0Yq4y91FCuR3icLOhuaZ0Hq2Irtf5TiJe80/Un//GIMc29JvOifi35TnBfVbw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdRilD0u2SelAGgcACHU+iZS5tb/NtG2f1mKno4re3UgIhANgYQWYh4cNtrolT0TguxrV7LXdU8J4rGT1EuJnJiYJy"}]},"maintainers":[{"name":"stephenplusplus","email":"sawchuk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/checkpoint-stream-0.1.1.tgz_1483723810362_0.5433475042227656"},"directories":{}},"0.1.2":{"name":"checkpoint-stream","version":"0.1.2","description":"Queue data from a stream until a checkpoint is hit","main":"index.js","scripts":{"lint":"standard","test":"mocha *.test.js"},"keywords":["queue","stream","checkpoint"],"author":{"name":"Stephen Sawchuk","email":"sawchuk@gmail.com"},"license":"MIT","devDependencies":{"async":"^2.1.4","mocha":"^3.2.0","standard":"^8.6.0"},"dependencies":{"@types/pumpify":"^1.4.1","events-intercept":"^2.0.0","pumpify":"^1.3.5","split-array-stream":"^1.0.0","through2":"^2.0.3"},"standard":{"global":["after","before","beforeEach","describe","it"]},"gitHead":"e386253b4f5ffc8bad870bcd5e2fbddc6822976d","_id":"checkpoint-stream@0.1.2","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"stephenplusplus","email":"stephenplusplusplus@gmail.com"},"dist":{"integrity":"sha512-eYXIcydL3mPjjEVLxHdi1ISgTwmxGJZ8vyJ3lYVvFTDRyTOZMTbKZdRJqiA7Gi1rPcwOyyzcrZmGLL8ff7e69w==","shasum":"5e2359456e5df4f3ec34c62bf1573e07df6e5039","tarball":"https://registry.npmjs.org/checkpoint-stream/-/checkpoint-stream-0.1.2.tgz","fileCount":5,"unpackedSize":7462,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQeN2CRA9TVsSAnZWagAA/PcP/3GbD6QCFMoLWNKriazQ\nVBmYI7ATulWWU1rAzeL/2628xwVZ3eaNikCYQYydF1UmM78dS/esaBwfy1+d\nKFh4qGF+ke1DuJrrNbs+XwNCOmtAYpZevPICMzKFnTQaG+jpmMjOGEC6xcgd\nPFmRCI4OQzukCSIysmCZHnhVyNrh4GXgEUc9g1CrTLkfyfGfl3mlnAbw2bOS\nGTCnakYZo2AKjzjSxY2gFD07LVl25XbP1wDE9BMrBjsca0WA3XrgV57Twpgf\n08HMdA8S6OLpTyAz4nfvfhK8OR3sy78+N/57iNw5K9G0Dp9m1U2fGyTep5It\n5dEVK6pp1kVp/Zr4k88+ZMswFAQBcgqTFGwzdHeerACf/XoZMKe2jLi3sZRJ\n7ExOxD3D1lrmL3bDWDAsSF88Q/auvO2IZh9bTkS5nXyz4e9I/ZXVX3Oaz9eg\nb1fFUtVynd1UrgbbvBSOCC5XetI8c9q9ZiRNvYk/SoDzCVH/Kk+1g0M/d6/P\n8HYGnQzTkII4l0fru6qhzSX+MC9SFBmjYMj095JES/3umj8zJF05aKb4/epj\nek/3MySbLiVBdt3VaNoZju1y72zF1a5ZdVWD0+tPBpb0SQntPun4aAQOKDca\nU7KmY6ZEeqLN1dy+mqyxDhqh/dWM8GQ2vGKxGl21yqBgZEIhayEv8Mu3wwTr\nuxos\r\n=NTHt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAO0xz8Tg1EzuRc/ZzaQ6rJwcpcnAdBAbr07CmAG/ikoAiBx2wQwTLAVvLCMH547uzSI7ghVFWcMBMwtJdYmmTAfqw=="}]},"maintainers":[{"name":"stephenplusplus","email":"sawchuk@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/checkpoint-stream_0.1.2_1547821941681_0.29584743806523717"},"_hasShrinkwrap":false}},"readme":"# checkpoint-stream\n> Queue data from a stream until a checkpoint is hit\n\n```sh\n$ npm install --save checkpoint-stream\n```\n```js\nvar checkpoint = require('checkpoint-stream')\n\n// getObjectsStream() returns a stream that emits multiple objects\n// this will queue up those objects until we reach a checkpoint\n// once the `isCheckpointFn` test passes, the queue is flushed\n\ngetObjectsStream()\n  .on('error', function() {...})\n  .pipe(checkpoint.obj(function(obj) {\n    return typeof obj.token !== 'undefined'\n  }))\n  .on('checkpoint', function(obj) {\n    // the obj from `getObjectsStream()` that passed the `isCheckpointFn` test\n  })\n  .on('data', function(obj) {\n    // emitted for each object\n  })\n```\n\n### Why would I want this?\n\nSay you're working with a streaming API that returns many results. Anywhere during transmission, the API call could fail. The API knows this, so it periodically returns a token you can use when you retry the request.\n\nWhen you get a result that has that token, that's kind of like a \"checkpoint\". It means, release all the results we've received up until now, because we know we'll be able to pick up from here when we go to retry the request.\n\n## API\n\n### checkpointStream(config)\n\n- Returns `TransformStream` (via [`through2`](http://gitnpm.com/through2))\n\n### checkpointStream.obj(config)\n\n- Returns `TransformStream` (via [`through2`](http://gitnpm.com/through2))\n\n#### config\n\n- **Required**\n- Type: `Object` or `Function`\n\nA configuration object. If a function is provided, it is treated as `config.isCheckpointFn`.\n\n##### config.isCheckpointFn\n\n- **Required**\n- Type: `Function`\n\nThis function will receive each data event that is emitted from the source stream. Return a boolean to indicate if this is a checkpoint or not. If it is a checkpoint, this event, and any previously queued events before it will be passed through to the next stream in your pipeline. If it is not a checkpoint, this event will be queued until you return `true` in a future data event.\n\n##### config.maxQueued\n\n- *Optional*\n- Type: `Number`\n- Default: `10`\n\nConfigure how many results will be queued before they are released, regardless of if a checkpoint has been reached.\n\n##### config.objectMode\n\n- *Optional*\n- Type: `Boolean`\n- Default: `false`\n\nEnable `objectMode` when dealing with streams in object mode.\n","maintainers":[{"name":"stephenplusplus","email":"sawchuk@gmail.com"}],"time":{"modified":"2022-06-13T05:56:17.689Z","created":"2016-12-22T17:02:10.166Z","0.1.0":"2016-12-22T17:02:10.166Z","0.1.1":"2017-01-06T17:30:10.971Z","0.1.2":"2019-01-18T14:32:21.772Z"},"keywords":["queue","stream","checkpoint"],"author":{"name":"Stephen Sawchuk","email":"sawchuk@gmail.com"},"license":"MIT","readmeFilename":"readme.md"}