@aegisai/opik
Version:
Opik TypeScript and JavaScript SDK
1 lines • 1.26 kB
JavaScript
import'./chunk-WOT6VMZA.js';var i=class{constructor(e){this.readableStream=e;}on(e,r){this.readableStream.on(e,r);}off(e,r){this.readableStream.off(e,r);}pipe(e){return this.readableStream.pipe(e),e}pipeTo(e){return this.pipe(e)}unpipe(e){e?this.readableStream.unpipe(e):this.readableStream.unpipe();}destroy(e){this.readableStream.destroy(e);}pause(){this.readableStream.pause();}resume(){this.readableStream.resume();}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((e,r)=>{let a=this.readableStream.read();a?e(a):(this.readableStream.once("readable",()=>{let t=this.readableStream.read();e(t);}),this.readableStream.once("error",r));})}setEncoding(e){this.readableStream.setEncoding(e),this.encoding=e;}async text(){let e=[],r=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let t of this.readableStream)e.push(r.encode(t));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(e))}async json(){let e=await this.text();return JSON.parse(e)}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return {async next(){let{value:a,done:t}=await r.next();return {value:a,done:t}},[Symbol.asyncIterator](){return this}}}};export{i as NodePre18StreamWrapper};