Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/cloneable-readable/ |
Upload File : |
'use strict' var PassThrough = require('readable-stream').PassThrough var inherits = require('inherits') var p = require('process-nextick-args') function Cloneable (stream, opts) { if (!(this instanceof Cloneable)) { return new Cloneable(stream, opts) } var objectMode = stream._readableState.objectMode this._original = stream this._clonesCount = 1 opts = opts || {} opts.objectMode = objectMode PassThrough.call(this, opts) forwardDestroy(stream, this) this.on('newListener', onData) this.once('resume', onResume) this._hasListener = true } inherits(Cloneable, PassThrough) function onData (event, listener) { if (event === 'data' || event === 'readable') { this._hasListener = false this.removeListener('newListener', onData) this.removeListener('resume', onResume) p.nextTick(clonePiped, this) } } function onResume () { this._hasListener = false this.removeListener('newListener', onData) p.nextTick(clonePiped, this) } Cloneable.prototype.clone = function () { if (!this._original) { throw new Error('already started') } this._clonesCount++ // the events added by the clone should not count // for starting the flow this.removeListener('newListener', onData) var clone = new Clone(this) if (this._hasListener) { this.on('newListener', onData) } return clone } Cloneable.prototype._destroy = function (err, cb) { if (!err) { this.push(null) this.end() this.emit('close') } p.nextTick(cb, err) } function forwardDestroy (src, dest) { src.on('error', destroy) src.on('close', onClose) function destroy (err) { src.removeListener('close', onClose) dest.destroy(err) } function onClose () { dest.end() } } function clonePiped (that) { if (--that._clonesCount === 0 && !that._readableState.destroyed) { that._original.pipe(that) that._original = undefined } } function Clone (parent, opts) { if (!(this instanceof Clone)) { return new Clone(parent, opts) } var objectMode = parent._readableState.objectMode opts = opts || {} opts.objectMode = objectMode this.parent = parent PassThrough.call(this, opts) forwardDestroy(parent, this) parent.pipe(this) // the events added by the clone should not count // for starting the flow // so we add the newListener handle after we are done this.on('newListener', onDataClone) this.on('resume', onResumeClone) } function onDataClone (event, listener) { // We start the flow once all clones are piped or destroyed if (event === 'data' || event === 'readable' || event === 'close') { p.nextTick(clonePiped, this.parent) this.removeListener('newListener', onDataClone) } } function onResumeClone () { this.removeListener('newListener', onDataClone) p.nextTick(clonePiped, this.parent) } inherits(Clone, PassThrough) Clone.prototype.clone = function () { return this.parent.clone() } Cloneable.isCloneable = function (stream) { return stream instanceof Cloneable || stream instanceof Clone } Clone.prototype._destroy = function (err, cb) { if (!err) { this.push(null) this.end() this.emit('close') } p.nextTick(cb, err) } module.exports = Cloneable