Re:Deno on MDN
by steve_adams_86 on Monday August 23, 2021 @12:19PM
(#28278199)
Do you know if Deno chose to use strings instead of buffers to be more consistent with the browser? I know buffers can be faster, but overall I like that readTextFile is returning a string here. I suspect most use-cases ultimately want to handle the output as a string.
[ Parent
| on HN ]
Deno uses uint8array (pretty much Nodes Buffers (Node Buffers subclass UInt8Array these days)) for almost all methods. For example Deno comes with `Deno.readFile` which returns a Promise<UInt8Array>, but they include the special case Deno.readTextFile because of how common it is to convert the contents to a string.
Re:Deno on MDN
by steve_adams_86 on Monday August 23, 2021 @09:52PM
(#28284304)
Ah of course, that seems obvious in retrospect. Thanks for clarifying it for me!