{"name":"minipass-flush","version":"1.0.6","keywords":["minipass","flush","stream"],"author":{"url":"https://izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"minipass-flush@1.0.6","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/minipass-flush#readme","bugs":{"url":"https://github.com/isaacs/minipass-flush/issues"},"tap":{"check-coverage":true},"dist":{"shasum":"a3f43e5d588f3bd5f1585cc68504a5f05ebd77a8","tarball":"http://registry-npm.ywwl.com/minipass-flush/download/minipass-flush-1.0.6.tgz","fileCount":4,"integrity":"sha512-7Uf5gMJZ2kTkFisE3toGxT991s+cg+vMh42nbZGM2bNxfYVpkpqRudf1QrcOy72a3PwcL4JYqL+4NY7t0Hdd0A==","signatures":[{"sig":"MEQCID3dFYbNjcxrtJyJdLUAvGyO/ixJF9YlGvAQBuKECDYDAiBzLSBHFMr6W6C3z6SMD3QcyHKACTHTKxSHz7d5WUtv8A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4587,"size":2186,"noattachment":false,"key":"/minipass-flush/-/minipass-flush-1.0.6.tgz"},"main":"index.js","engines":{"node":">=16 || 14 >=14.17"},"gitHead":"9c019e3b9e760e21106a7c675f8c3a3c2f0028ed","scripts":{"snap":"tap","test":"tap","preversion":"npm test","postpublish":"git push origin --follow-tags","postversion":"npm publish"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"repository":{"url":"git+https://github.com/isaacs/minipass-flush.git","type":"git"},"_npmVersion":"11.10.0","description":"A Minipass stream that calls a flush function before emitting 'end'","directories":{},"_nodeVersion":"25.6.1","dependencies":{"minipass":"^7.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.1.6"},"_npmOperationalInternal":{"tmp":"tmp/minipass-flush_1.0.6_1774457751211_0.07615172143821947","host":"s3://npm-registry-packages-npm-production"},"readme":"# minipass-flush\n\nA Minipass stream that calls a flush function before emitting\n'end'.\n\n## USAGE\n\n```ts\nimport { Flush } from 'minipass-flush'\nconst f = new Flush<Buffer>({\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) return cb(er)\n      clearAllChannels(er => {\n        if (er) 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,\nthen it's better to call the callback right away in this tick,\nrather than returning `Promise.resolve()`, so that the `end`\nevent can happen as soon as possible.\n","publish_time":1774457751372,"_cnpm_publish_time":1774457751372,"dist-tags":{"latest":"2.0.1","v1-legacy":"1.0.7"}}