Proper way to write to FD 3 (on Windows)? #6305

@TooTallNate

Description

I'm trying to have deno output some information to file descriptor 3, so I am spawning deno like so:

$ deno run example.ts 3>three.txt

I have it working as expected by using /dev/fd/3 :

const fd = Deno.openSync('/dev/fd/3', { read: false, write: true });
Deno.writeAllSync(fd, new TextEncoder().encode('hello'));
Deno.close(fd.rid);

Ok fine, good. But what I am really interested is learning the proper way to do this in a cross-platform way that will work on Windows.

Thanks in advance!