{"name":"minipass-flush","version":"1.0.4","description":"A Minipass stream that calls a flush function before emitting 'end'","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.6.4"},"dependencies":{"minipass":"^2.6.2"},"main":"index.js","repository":{"type":"git","url":"git+https://github.com/isaacs/minipass-flush.git"},"keywords":["minipass","flush","stream"],"gitHead":"280c5c62a489e130a82b38353608522b5468f759","bugs":{"url":"https://github.com/isaacs/minipass-flush/issues"},"homepage":"https://github.com/isaacs/minipass-flush#readme","_id":"minipass-flush@1.0.4","_nodeVersion":"12.8.1","_npmVersion":"6.11.3","dist":{"integrity":"sha512-xr8SwVhu0UQTN3Fn8A2kyFubTZX/UCMDi0z7/LtyFkaTu8+5m0XeWODyj/gY1fG/GAf6qGfODfPc8RmHVaYJ+A==","shasum":"e43261649da7ff9b9db529edc635b8f835411759","tarball":"http://registry-npm.ywwl.com/minipass-flush/download/minipass-flush-1.0.4.tgz","fileCount":4,"unpackedSize":3732,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdglZ5CRA9TVsSAnZWagAA71UP/3dF1aU/oWrtPakLVuAu\nawyNuixs/lZwWGTzOGDyhWOrWl3pP2TfCeTrn6pbk9y1pxsqB11FSzA0vxol\nbKO5VrsLkVpb2G0argo27QfJRjM6nU1AdEvkcXykZLQ9cIFB0TycoHEoyKVm\nOHRr8C5kCAOU/braBjZ0NDiQdpxDdMheqPIvV3+/ID+yX0P1UZZpvnx6U8a7\nhtL7d4dxHO1foAwaZkGFSZBVEiFdLKGhAbILwgi+ejMNjqB4CqAIPig76yLs\n8HSQwY9XhA45zuewoF+Kf3o0EfuGGqN8mg15Y6OGsdCh24bwb45CEXRYxh6W\nc//MsIfZeTFe35mozxSRbc5lhwT1kxu3Ofxn8JLrF476GmVrvWlTIb5ttxSO\nZi8O3e98awT7zq/Mk6mJCaUBoZ9fcLAHSnSxdiaC1oN/rT4axP70SdqvwTOQ\nxkoPJInn6EK8ywQlf82lyO73e5dliXaR0Na8fLB+MS8Jea3n8YZmpPlFdXLQ\nhUGPmUHQYzXh5taIadwkRXl90lHsnkuWSXin6IMAduiM0tkfbNyFWT078lF7\nvfZ64ZO7T+AuvXy+V2/criJ8WSbuX71anir9/+YaP8pqAuqVq+QMKjlVg3vf\nnJ0I03xgPSWVCNGq90EUFUD9+BsL3pkKNZbm6JGn8EVhSFNKII4cYba8yboB\ncgt8\r\n=rO7E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAILZtxy+nJjObBN5VQd86OdOzuw+2DdIyS8u9atPc9CAiBrcB/RE177DEEyrp7uCEP8v11vFqmGjxmteihD+BmTEA=="}],"size":1953,"noattachment":false,"key":"/minipass-flush/-/minipass-flush-1.0.4.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/minipass-flush_1.0.4_1568822904729_0.3900350616791064"},"_hasShrinkwrap":false,"readme":"# minipass-flush\n\nA Minipass stream that calls a flush function before emitting 'end'\n\n## USAGE\n\n```js\nconst Flush = require('minipass-flush')\ncons f = new Flush({\n  flush (cb) {\n    // call the cb when done, or return a promise\n    // the 'end' event will wait for it, along with\n    // close, finish, and prefinish.\n    // call the cb with an error, or return a rejecting\n    // promise to emit 'error' instead of doing the 'end'\n    return rerouteAllEncryptions().then(() => clearAllChannels())\n  },\n  // all other minipass options accepted as well\n})\n\nsomeDataSource.pipe(f).on('end', () => {\n  // proper flushing has been accomplished\n})\n\n// Or as a subclass implementing a 'flush' method:\nclass MyFlush extends Flush {\n  flush (cb) {\n    // old fashioned callback style!\n    rerouteAllEncryptions(er => {\n      if (er)\n        return cb(er)\n      clearAllChannels(er => {\n        if (er)\n          cb(er)\n        cb()\n      })\n    })\n  }\n}\n```\n\nThat's about it.\n\nIf your `flush` method doesn't have to do anything asynchronous, then it's\nbetter to call the callback right away in this tick, rather than returning\n`Promise.resolve()`, so that the `end` event can happen as soon as\npossible.\n","publish_time":1568822904970,"_cnpm_publish_time":1568822904970,"dist-tags":{"latest":"2.0.1","v1-legacy":"1.0.7"}}