{"name":"minipass-flush","version":"2.0.0","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@2.0.0","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/minipass-flush#readme","bugs":{"url":"https://github.com/isaacs/minipass-flush/issues"},"dist":{"shasum":"8c7148ff179add01261cc866e90ecfd27771d7f8","tarball":"http://registry-npm.ywwl.com/minipass-flush/download/minipass-flush-2.0.0.tgz","fileCount":3,"integrity":"sha512-sorJ6CsF90lm6KiFxxpBTXPKCleFqcVNH4DzkdDd/9RFcsiR6G7k3okKR3WWDjci4O1Ngf/7KLwjrWQx9vmK0A==","signatures":[{"sig":"MEUCIQDBQPu1hBVKzkhJM9gnNqAa3RpNY/n/CrvdOclcldk6PQIgPdsZD+vK0q8xC2yPboJmJQTe70P6ZmmqzIOADA0v20g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4568,"size":2098,"noattachment":false,"key":"/minipass-flush/-/minipass-flush-2.0.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"},"compiler":"tsgo","selfLink":false},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=16 || 14 >=14.17"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"6b4984986f6f115224419aaf6bdb0bb459d32077","scripts":{"lint":"oxlint --fix src test","snap":"tap","test":"tap","format":"prettier --write .","prepare":"tshy","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc","postlint":"npm run format","postsnap":"npm run lint","preversion":"npm test","postpublish":"git push origin --follow-tags","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"repository":{"url":"git+https://github.com/isaacs/minipass-flush.git","type":"git"},"_npmVersion":"11.11.1","description":"A Minipass stream that calls a flush function before emitting 'end'","directories":{},"_nodeVersion":"25.8.2","dependencies":{"minipass":"^7.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^21.6.2","tshy":"^4.0.0","oxlint":"^1.57.0","typedoc":"^0.28.18","prettier":"^3.8.1","@types/node":"^25.5.0","oxlint-tsgolint":"^0.17.4"},"_npmOperationalInternal":{"tmp":"tmp/minipass-flush_2.0.0_1774467359466_0.172369624692168","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":1774467359606,"_cnpm_publish_time":1774467359606,"dist-tags":{"latest":"2.0.1","v1-legacy":"1.0.7"}}