summaryrefslogtreecommitdiff
path: root/school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js
diff options
context:
space:
mode:
Diffstat (limited to 'school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js')
-rw-r--r--school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js b/school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js
new file mode 100644
index 0000000..dc5909c
--- /dev/null
+++ b/school/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js
@@ -0,0 +1,9 @@
+"use strict";
+
+// See https://github.com/jsdom/jsdom/pull/2743#issuecomment-562991955 for background.
+exports.copyToArrayBufferInNewRealm = (nodejsBuffer, newRealm) => {
+ const newAB = new newRealm.ArrayBuffer(nodejsBuffer.byteLength);
+ const view = new Uint8Array(newAB);
+ view.set(nodejsBuffer);
+ return newAB;
+};