{"name":"minipass-flush","version":"1.0.2","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"},"gitHead":"1fc00e064c1e43f1508141a2d3e7979fb057855f","_id":"minipass-flush@1.0.2","_nodeVersion":"12.8.1","_npmVersion":"6.11.3","dist":{"integrity":"sha512-k8lFq5QINRSQjpJhC9bQjW18dTIFBtH6PTaXArdtaBpsCDYeXrYUEdbn74lgY/Sy/TQZFSMjVaZIG0z7oJWaoQ==","shasum":"9160f1b98124c151f7b3565a493660ed7c1868e6","tarball":"http://registry-npm.ywwl.com/minipass-flush/download/minipass-flush-1.0.2.tgz","fileCount":4,"unpackedSize":3522,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgAq3CRA9TVsSAnZWagAAiDsQAI4TuiEF/MYcKNeKR/1F\nsGbC4WZU81bJ4MIwV0FXWTx4xD5nhCS6GSTuaS1MF6xpdG9ijXC+7hnuGn0o\nNzTTKtKEl2FvMrn4HwiCsQzxED+EfxSEGK2/BUcBEtrHarW/pOBxk7JzVDoH\nuRVc55CXDH+Tof9orFcCTLnSTfx9ZIzN4zf7vcmLIndq/uFu0GGWQBy3ZP0i\nUIQWxQnT3tbSTcWj12OPl5ByZMciDjRPtoYeP2yp5R40fppn1TIPucNgokwe\njLBGaJeOJdi8fElTEvNMzVgt8Us48mv/hzJ6Fu1SLcTCslp3yC2dkwmSG7RY\n6dGKFg4fquOnoe3P5u3psqv0ixk64bVqo4qo6KQNrg1GeUssUjJodBzQQbYt\nGS5hF+DjEjm3eJeA000Y9hZxkRbxKrfXopDZLcmKroiVco3o1XIpyGRFQrKK\nT7P3LG8qC2JFDuzjLciCovlxaqZPOoyFfLoPqga4GZlTfsYNJWELEyZH7ERM\npB5vc+TCERp8Bdmj0xRMttDuun1uZuFZNT2FhzbdELuGN5yJnXjs0IL2N7v8\n3UoPfAiOfxxwrVLYva4sKbwT7sKSbLcesEDPG/024pc/Lesk2AL37U68RAl6\nr6NV2hVw4hhDNWabEdPN/w02EN9IT6Pzf7E5W7Hp0857XMoSGqCprA1S2Qkg\nwpGg\r\n=R5LV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH+eeONxpInQfuDhQnPOm1oGNg5MR7gi/S/N7x9Hk5c9AiA34gK2WD4oYQm6lBgbtaIXl40j6JcV6e5XDKf0otLtjw=="}],"size":1879,"noattachment":false,"key":"/minipass-flush/-/minipass-flush-1.0.2.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.2_1568672438692_0.1324160550195963"},"_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":1568672438803,"_cnpm_publish_time":1568672438803,"dist-tags":{"latest":"2.0.1","v1-legacy":"1.0.7"}}