import { Writable } from "stream" ; import { OutputChannel , window } from "vscode" ; export default class VSCChannelWriteStream extends Writable implements NodeJS . WritableStream { private readonly channel : OutputChannel ; param { string } channelName memberof public constructor ( public readonly channelName ) { super ( ) ; this . channel = window . createOutputChannel ( channelName ) ; } public _write ( chunk , encoding , callback ) { this . channel . append ( typeof chunk === "string" ? chunk : chunk . toString ( ) ) ; callback ( ) ; } }