-
Notifications
You must be signed in to change notification settings - Fork 306
fs.writeSync is producing hex not utf8? #2087
Copy link
Copy link
Closed
Description
I am non MacOS Node.js version 12.3
I have this:
const logFD = fs.openSync(somefilepath, 'w+');
try {
fs.writeSync(logFD, JSON.stringify({p: pos, b: byteLen}), h * 100, 'utf-8');
} catch (err) {
consumer.warn(err.message || err);
}I also tried using 'utf8' instead of 'utf-8'
I am always getting hex or whatever this is in the file:
6222 3a34 367d 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 7b22 7022 3a37 3239
3039 2c22 6222 3a32 317d 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 7b22 7022 3a37 3339 3331 2c22
6222 3a31 3032 7d00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
is there some reason it's not readable as utf8?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels