aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/builtins/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/builtins/js')
-rw-r--r--src/bun.js/builtins/js/JSBufferPrototype.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bun.js/builtins/js/JSBufferPrototype.js b/src/bun.js/builtins/js/JSBufferPrototype.js
index de80450b1..310870540 100644
--- a/src/bun.js/builtins/js/JSBufferPrototype.js
+++ b/src/bun.js/builtins/js/JSBufferPrototype.js
@@ -284,6 +284,17 @@ function subarray(start, end) {
return new Buffer(this.buffer, this.byteOffset + (start || 0), (end || this.byteLength) - (start || 0));
}
+function slice(start, end) {
+ "use strict";
+ if (start === undefined && end === undefined) {
+ return this;
+ }
+
+ Buffer[Symbol.species] ||= Buffer;
+
+ return new Buffer(this.buffer, this.byteOffset + (start || 0), (end || this.byteLength) - (start || 0));
+}
+
function initializeBunBuffer(parameters)
{