Cheddar
Cheddar copied to clipboard
fd#write(: Buffer) does not write
Version: v1.0.5
fd#write
function when passed a Buffer
, does not write any text to the file. However when passed a String
object, it correctly writes to the file
Just convert the Buffer to a string. All 😝
@schas002 however the lovely UTF16 will mangle your bytes.
Make something that enforces a 256-character encoding on strings. (Like, a Latin1String.) Then convert the Buffer to a string with that rule enforced and you're done. 😝
The problem is that enforces a 256 character encoding. What if you want unicode?
I suggested a new type.
in "(Like, a Latin1String.)"
That would be slow and it would be a buffer internally anyway.
Strings are kinda like:
Input Internal Output
Source Encoding -> UTF-16 -> Target Encoding
Meaning internally they are stored as UTF-16
However Output
is a buffer anyway
So we may go only the hard path: using rubber ducks to resolve the problem.