Skip to content
Closed
Changes from all commits
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
6 changes: 3 additions & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ Buffer.copyBytesFrom = function copyBytesFrom(view, offset, length) {

const viewLength = TypedArrayPrototypeGetLength(view);
if (viewLength === 0) {
return Buffer.alloc(0);
return new FastBuffer();
}

if (offset !== undefined || length !== undefined) {
if (offset !== undefined) {
validateInteger(offset, 'offset', 0);
if (offset >= viewLength) return Buffer.alloc(0);
if (offset >= viewLength) return new FastBuffer();
} else {
offset = 0;
}
Expand Down Expand Up @@ -1257,7 +1257,7 @@ if (internalBinding('config').hasIntl) {
throw new ERR_INVALID_ARG_TYPE('source',
['Buffer', 'Uint8Array'], source);
}
if (source.length === 0) return Buffer.alloc(0);
if (source.length === 0) return new FastBuffer();

fromEncoding = normalizeEncoding(fromEncoding) || fromEncoding;
toEncoding = normalizeEncoding(toEncoding) || toEncoding;
Expand Down
Loading