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/vue/src/server/ |
Upload File : |
/* @flow */ /** * Original RenderStream implementation by Sasha Aickin (@aickin) * Licensed under the Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Modified by Evan You (@yyx990803) */ const stream = require('stream') import { isTrue, isUndef } from 'shared/util' import { createWriteFunction } from './write' export default class RenderStream extends stream.Readable { buffer: string; render: (write: Function, done: Function) => void; expectedSize: number; write: Function; next: Function; end: Function; done: boolean; constructor (render: Function) { super() this.buffer = '' this.render = render this.expectedSize = 0 this.write = createWriteFunction((text, next) => { const n = this.expectedSize this.buffer += text if (this.buffer.length >= n) { this.next = next this.pushBySize(n) return true // we will decide when to call next } return false }, err => { this.emit('error', err) }) this.end = () => { this.emit('beforeEnd') // the rendering is finished; we should push out the last of the buffer. this.done = true this.push(this.buffer) } } pushBySize (n: number) { const bufferToPush = this.buffer.substring(0, n) this.buffer = this.buffer.substring(n) this.push(bufferToPush) } tryRender () { try { this.render(this.write, this.end) } catch (e) { this.emit('error', e) } } tryNext () { try { this.next() } catch (e) { this.emit('error', e) } } _read (n: number) { this.expectedSize = n // it's possible that the last chunk added bumped the buffer up to > 2 * n, // which means we will need to go through multiple read calls to drain it // down to < n. if (isTrue(this.done)) { this.push(null) return } if (this.buffer.length >= n) { this.pushBySize(n) return } if (isUndef(this.next)) { // start the rendering chain. this.tryRender() } else { // continue with the rendering. this.tryNext() } } }