ssh2 icon indicating copy to clipboard operation
ssh2 copied to clipboard

By default stream is outputting `string` is there a way to get a `Buffer`?

Open metawrap-dev opened this issue 11 months ago • 1 comments

I am implementing a server, and logging data arriving from a stream after a call to

// Create a stream for Git Smart Protocol communication
const stream: ssh2.ServerChannel = acceptExec()

By that I mean performing a typeof on the object from stream.on('data', data => {console.log(typeof data)}) returns string

Am I doing something wrong?

metawrap-dev avatar Jan 23 '25 09:01 metawrap-dev

Are you using ssh2 directly? If so, can you show a complete minimal example in JS that reproduces the problem? Streams should always emit Buffers unless you call something like stream.setEncoding().

mscdex avatar Jan 23 '25 15:01 mscdex