{"name":"minipass-flush","version":"2.0.1","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":"BlueOak-1.0.0","scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags","prepare":"tshy","typedoc":"typedoc","prepublishOnly":"git push origin --follow-tags","pretest":"npm run prepare","presnap":"npm run prepare","lint":"oxlint --fix src test","format":"prettier --write .","postsnap":"npm run lint","postlint":"npm run format"},"devDependencies":{"@types/node":"^25.5.0","oxlint":"^1.57.0","oxlint-tsgolint":"^0.17.4","prettier":"^3.8.1","tap":"^21.6.2","tshy":"^4.1.3","typedoc":"^0.28.18"},"dependencies":{"minipass":"^7.1.3"},"main":"./dist/commonjs/index.js","repository":{"type":"git","url":"git+https://github.com/isaacs/minipass-flush.git"},"keywords":["minipass","flush","stream"],"engines":{"node":">=16 || 14 >=14.17"},"type":"module","tshy":{"selfLink":false,"compiler":"tsgo","exports":{"./package.json":"./package.json",".":"./src/index.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","gitHead":"8f2efde562134f4b68f76ec83b249800adf9d2f7","_id":"minipass-flush@2.0.1","bugs":{"url":"https://github.com/isaacs/minipass-flush/issues"},"homepage":"https://github.com/isaacs/minipass-flush#readme","_nodeVersion":"26.0.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-ZscKuP79dpdQL+/m2Cx9KMQ3VnUI51ChMPqCKTz6Qi2F2Jqu5Mu23CV7oSkMoXJr3w5SusKE4wLVGODQ8IesJA==","shasum":"115be7fbb06f9be1a5e92a7763c8f9d5bbcad338","tarball":"http://registry-npm.ywwl.com/minipass-flush/download/minipass-flush-2.0.1.tgz","fileCount":13,"unpackedSize":18211,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAiFpDJ1ugRv6Lmrz/BWDoMZnaJvbcAlYonzzbthicg3AiAVU3/3xSziSHgtz9ZRaWuw8hJoai6J5HW2vjWdO1vQHg=="}],"size":4420,"noattachment":false,"key":"/minipass-flush/-/minipass-flush-2.0.1.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/minipass-flush_2.0.1_1780944953018_0.11964144066679028"},"_hasShrinkwrap":false,"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":1780944953212,"_cnpm_publish_time":1780944953212,"dist-tags":{"latest":"2.0.1","v1-legacy":"1.0.7"}}