m4rc3l05M
Denoβ€’16mo agoβ€’
19 replies
m4rc3l05

How to check if stdin is a file?

Hey, how does one check if stdin is a file? in nodejs we could do something like fs.fstatSync(process.stdin.fd).isFile() (example: https://github.com/pinojs/pino-pretty/blob/master/bin.js#L86) which in deno can be translated to Deno.fstatSync(Deno.stdin.rid).isFile.

Despite this working for for deno v1, it will not work for deno v2 since both fstatSync and rid will be deprecated, with the first one being deleted entirely.

So for deno v2 how can we do this?
Was this page helpful?