revert e5e2aca0c4
revert Merge branch 'main' of http://47.107.152.87:3000/liubiao/APP # Conflicts: # .gitignore # pages/common/index/index.vue # unpackage/dist/dev/app-plus/app-config-service.js # unpackage/dist/dev/app-plus/app-service.js # unpackage/dist/dev/app-plus/app-view.js # unpackage/dist/dev/app-plus/manifest.json # utils/request.js
This commit is contained in:
51
node_modules/callback-stream/index.js
generated
vendored
Normal file
51
node_modules/callback-stream/index.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict'
|
||||
|
||||
var Writable = require('readable-stream').Writable
|
||||
var inherits = require('inherits')
|
||||
|
||||
function CallbackStream (options, callback) {
|
||||
if (!(this instanceof CallbackStream)) {
|
||||
return new CallbackStream(options, callback)
|
||||
}
|
||||
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
Writable.call(this, options)
|
||||
|
||||
this.results = []
|
||||
this.callback = callback
|
||||
|
||||
this.on('finish', deliversCallback)
|
||||
this.once('pipe', handlePipe)
|
||||
}
|
||||
|
||||
function deliversCallback () {
|
||||
this.callback(null, this.results)
|
||||
}
|
||||
|
||||
function handlePipe (source) {
|
||||
source.on('error', this.callback)
|
||||
}
|
||||
|
||||
inherits(CallbackStream, Writable)
|
||||
|
||||
CallbackStream.prototype._write = function (data, encoding, done) {
|
||||
this.results.push(data)
|
||||
done()
|
||||
}
|
||||
|
||||
CallbackStream.obj = function (options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
options.objectMode = true
|
||||
|
||||
return new CallbackStream(options, callback)
|
||||
}
|
||||
|
||||
module.exports = CallbackStream
|
Reference in New Issue
Block a user