UNPKG

node-jt400

Version:
33 lines 938 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IfsReadStream = IfsReadStream; const util = require("util"); const stream_1 = require("stream"); function IfsReadStream(opt) { stream_1.Readable.call(this, { objectMode: false, }); this._ifsReadStream = opt.ifsReadStream; this._javaTypeToBuffer = opt.javaTypeToBuffer; this._buffer = []; } util.inherits(IfsReadStream, stream_1.Readable); IfsReadStream.prototype._read = function () { const _this = this; const streamPromise = this._ifsReadStream; streamPromise .then((stream) => { stream .read() .then((res) => { this.push(this._javaTypeToBuffer(res)); }) .catch((err) => { _this.emit('error', err); }); }) .catch((err) => { this.emit('error', err); }); }; //# sourceMappingURL=read_stream.js.map