first commit
This commit is contained in:
55
server/node_modules/minipass-flush/LICENSE.md
generated
vendored
Normal file
55
server/node_modules/minipass-flush/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# Blue Oak Model License
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
## Purpose
|
||||
|
||||
This license gives everyone as much permission to work with
|
||||
this software as possible, while protecting contributors
|
||||
from liability.
|
||||
|
||||
## Acceptance
|
||||
|
||||
In order to receive this license, you must agree to its
|
||||
rules. The rules of this license are both obligations
|
||||
under that agreement and conditions to your license.
|
||||
You must not do anything with this software that triggers
|
||||
a rule that you cannot or will not follow.
|
||||
|
||||
## Copyright
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe that contributor's
|
||||
copyright in it.
|
||||
|
||||
## Notices
|
||||
|
||||
You must ensure that everyone who gets a copy of
|
||||
any part of this software from you, with or without
|
||||
changes, also gets the text of this license or a link to
|
||||
<https://blueoakcouncil.org/license/1.0.0>.
|
||||
|
||||
## Excuse
|
||||
|
||||
If anyone notifies you in writing that you have not
|
||||
complied with [Notices](#notices), you can keep your
|
||||
license by taking all practical steps to comply within 30
|
||||
days after the notice. If you do not do so, your license
|
||||
ends immediately.
|
||||
|
||||
## Patent
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe any patent claims
|
||||
they can license or become able to license.
|
||||
|
||||
## Reliability
|
||||
|
||||
No contributor can revoke this license.
|
||||
|
||||
## No Liability
|
||||
|
||||
***As far as the law allows, this software comes as is,
|
||||
without any warranty or condition, and no contributor
|
||||
will be liable to anyone for any damages related to this
|
||||
software or this license, under any kind of legal claim.***
|
||||
47
server/node_modules/minipass-flush/README.md
generated
vendored
Normal file
47
server/node_modules/minipass-flush/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# minipass-flush
|
||||
|
||||
A Minipass stream that calls a flush function before emitting 'end'
|
||||
|
||||
## USAGE
|
||||
|
||||
```js
|
||||
const Flush = require('minipass-flush')
|
||||
const f = new Flush({
|
||||
flush (cb) {
|
||||
// call the cb when done, or return a promise
|
||||
// the 'end' event will wait for it, along with
|
||||
// close, finish, and prefinish.
|
||||
// call the cb with an error, or return a rejecting
|
||||
// promise to emit 'error' instead of doing the 'end'
|
||||
return rerouteAllEncryptions().then(() => clearAllChannels())
|
||||
},
|
||||
// all other minipass options accepted as well
|
||||
})
|
||||
|
||||
someDataSource.pipe(f).on('end', () => {
|
||||
// proper flushing has been accomplished
|
||||
})
|
||||
|
||||
// Or as a subclass implementing a 'flush' method:
|
||||
class MyFlush extends Flush {
|
||||
flush (cb) {
|
||||
// old fashioned callback style!
|
||||
rerouteAllEncryptions(er => {
|
||||
if (er)
|
||||
return cb(er)
|
||||
clearAllChannels(er => {
|
||||
if (er)
|
||||
cb(er)
|
||||
cb()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
That's about it.
|
||||
|
||||
If your `flush` method doesn't have to do anything asynchronous, then it's
|
||||
better to call the callback right away in this tick, rather than returning
|
||||
`Promise.resolve()`, so that the `end` event can happen as soon as
|
||||
possible.
|
||||
39
server/node_modules/minipass-flush/index.js
generated
vendored
Normal file
39
server/node_modules/minipass-flush/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
const Minipass = require('minipass')
|
||||
const _flush = Symbol('_flush')
|
||||
const _flushed = Symbol('_flushed')
|
||||
const _flushing = Symbol('_flushing')
|
||||
class Flush extends Minipass {
|
||||
constructor (opt = {}) {
|
||||
if (typeof opt === 'function')
|
||||
opt = { flush: opt }
|
||||
|
||||
super(opt)
|
||||
|
||||
// or extend this class and provide a 'flush' method in your subclass
|
||||
if (typeof opt.flush !== 'function' && typeof this.flush !== 'function')
|
||||
throw new TypeError('must provide flush function in options')
|
||||
|
||||
this[_flush] = opt.flush || this.flush
|
||||
}
|
||||
|
||||
emit (ev, ...data) {
|
||||
if ((ev !== 'end' && ev !== 'finish') || this[_flushed])
|
||||
return super.emit(ev, ...data)
|
||||
|
||||
if (this[_flushing])
|
||||
return
|
||||
|
||||
this[_flushing] = true
|
||||
|
||||
const afterFlush = er => {
|
||||
this[_flushed] = true
|
||||
er ? super.emit('error', er) : super.emit('end')
|
||||
}
|
||||
|
||||
const ret = this[_flush](afterFlush)
|
||||
if (ret && ret.then)
|
||||
ret.then(() => afterFlush(), er => afterFlush(er))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Flush
|
||||
42
server/node_modules/minipass-flush/package.json
generated
vendored
Normal file
42
server/node_modules/minipass-flush/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "minipass-flush",
|
||||
"version": "1.0.7",
|
||||
"publishConfig": {
|
||||
"tag": "v1-legacy"
|
||||
},
|
||||
"description": "A Minipass stream that calls a flush function before emitting 'end'",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (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"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^15.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/minipass-flush.git"
|
||||
},
|
||||
"keywords": [
|
||||
"minipass",
|
||||
"flush",
|
||||
"stream"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user