Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fs: refactor fs for performance
The main changes are
- combine errorHandler and nullCheck
- remove getOptions and copyObject
- improve callback handling
- improve flags handling
- improve writeFile and instanceOf checks
- improve read- and writestream
- improve path check
- inline functions if possible
- var to const

The code got also cleaned up in the process
  • Loading branch information
BridgeAR committed Sep 19, 2017
commit 65e9d6b5fa23c25acf200c51500b476c48133a9b
4 changes: 2 additions & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ Buffer.compare = function compare(a, b) {

Buffer.isEncoding = function isEncoding(encoding) {
return typeof encoding === 'string' &&
typeof normalizeEncoding(encoding) === 'string';
normalizeEncoding(encoding) !== undefined;
};
Buffer[kIsEncodingSymbol] = Buffer.isEncoding;

Expand All @@ -465,7 +465,7 @@ Buffer.concat = function concat(list, length) {
length = length >>> 0;
}

var buffer = Buffer.allocUnsafe(length);
const buffer = Buffer.allocUnsafe(length);
var pos = 0;
for (i = 0; i < list.length; i++) {
var buf = list[i];
Expand Down
Loading