/
eapostnova
/
2026-1--study--mathmod
Обзор
Документация
Войти
/
eapostnova
/
2026-1--study--mathmod
Код
Запросы
0
Задачи
Пакеты
0
Релизы
6
Аналитика
Безопасность
master
node_modules/fast-xml-parser/src/cli/read.js
43 строки
816 B
Елизавета Постнова
feat(main): make course structure
21 мар 2026, 21:05
Верифицирован
21 мар 2026, 21:05
49fc17e
Код
Авторство
О чём код?
'use strict'; import { Transform } from 'stream'; export default class ReadToEnd extends Transform { constructor(options = {}) { super(options); this._encoding = options.encoding || 'utf8'; this._buffer = ''; } _transform(chunk, encoding, done) { this._buffer += chunk.toString(this._encoding); this.push(chunk); done(); } _flush(done) { this.emit('complete', null, this._buffer); done(); } static readToEnd(stream, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } const dest = new ReadToEnd(options); stream.pipe(dest); stream.on('error', (err) => { stream.unpipe(dest); callback(err); }); dest.on('complete', callback); dest.resume(); return dest; } }