Anyone know of a way to convert a <stream.Writable...
# javascript
m
Anyone know of a way to convert a stream.Writable into something synchronous, like Java's
java.io.OutputStream
???
Only way I know with Kotlin is via coroutines and make the
write
function of my wrapper a
suspend
function, but that is undesireable.
r
I would say there is no way to convert async to sync in a single threaded environment.
m
So you're saying I have to open a file descriptor, wrap it with a
stream.Readable
to pass to the
ChildProcess
for
stdin
, then write to that file descriptor via
writeSync
?
Uggh... don't even know if that'll work, and would need to be a named descriptor (file path) b/c can't open a unix pipe (or MS version of pipes)...
e
The answer is you cannot. I already went through the desperation phase and accepted it.
m
Yup, I spent about 2 hours trying to get something to work with custom
stream.Duplex
implementations, etc. The end result was sucking it up and adding the coroutines dependency sad panda
⏸️ 1