Closed rossanthony closed 2 years ago
I think the type should be updated.
cc @kibertoad
I can open a PR to correct the type, so it should be string|Number
?
The readme for SonicBoom should also change to reflect this, specifically here, how about changing this:
fd
: a file descriptor, something that is returned byfs.open
orfs.openSync
.
to:
fd
: a file descriptor, something that is returned byfs.open
orfs.openSync
, or a number (1: stdout, 2: stderr).
Or do both achieve exactly that same in piping the stream to stdout?
They both achieve the exact same thing.
The type
SonicBoomOpts
definesdest
as a string: https://github.com/pinojs/sonic-boom/blob/master/types/index.d.ts#L11, however it seems like you can also pass a number to it. As can be seen here within thepino-pretty/
library: https://github.com/pinojs/pino-pretty/blob/master/index.js#L193.Should the type be updated to
string|Number
to allow for passing 1 to indicate stdout and a string if passing a path to a file?I noticed that it's also possible to do this:
SonicBoom({ fd: process.stdout.fd })
how does this differ fromSonicBoom({ dest: 1 })
? Or do both achieve exactly that same in piping the stream to stdout?