lib: call normalizeEncoding in fs.writeFileSync and fs.readFileSync#60539
lib: call normalizeEncoding in fs.writeFileSync and fs.readFileSync#60539JonasBa wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
9143536 to
121725f
Compare
There was a problem hiding this comment.
This breaks default encoding to be buffer
normalizeEncoding normalizes undefined to 'utf8', but readFileSync does not set options.encoding to a default value at that point, unlike writeFileSync, and the expectation is to read Buffers by default, not strings
121725f to
862df86
Compare
862df86 to
771bd39
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60539 +/- ##
==========================================
- Coverage 88.58% 88.56% -0.03%
==========================================
Files 704 704
Lines 207839 207844 +5
Branches 40051 40043 -8
==========================================
- Hits 184117 184076 -41
- Misses 15791 15809 +18
- Partials 7931 7959 +28
🚀 New features to boost your workflow:
|
|
CI is going to fail unless #60552 is fixed first, which is though unrelated directly Basically, #60552 fix has to go in first. (Upd: #60553) |
|
@ChALkeR, I appreciate the thorough review and explanation here, thank you so much! |
Fixes #49888 by adding calls to
normalizeEncoding.Benchmarks between #f46152fdb3 and CL from this PR
I am open to suggestions here, but given that in the case of fast paths, the only encoding we care about is utf8, would it perhaps make more sense to have a
isUTF8Encoding()which would return a bool?Reviews and suggestions are much appreciated 🙏🏼