summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/fs/utils.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/fs/utils.mjs')
-rw-r--r--ext/node/polyfills/internal/fs/utils.mjs10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/node/polyfills/internal/fs/utils.mjs b/ext/node/polyfills/internal/fs/utils.mjs
index 9f3322bae..53184b9c3 100644
--- a/ext/node/polyfills/internal/fs/utils.mjs
+++ b/ext/node/polyfills/internal/fs/utils.mjs
@@ -986,6 +986,16 @@ export const validatePosition = hideStackFrames((position) => {
}
});
+/** @type {(buffer: ArrayBufferView) => Uint8Array} */
+export const arrayBufferViewToUint8Array = hideStackFrames(
+ (buffer) => {
+ if (!(buffer instanceof Uint8Array)) {
+ return new Uint8Array(buffer.buffer);
+ }
+ return buffer;
+ },
+);
+
export const realpathCacheKey = Symbol("realpathCacheKey");
export const constants = {
kIoMaxLength,