We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 690f5f9 commit 9ad7df6Copy full SHA for 9ad7df6
lib/ewasm/memory.js
@@ -4,6 +4,13 @@ module.exports = class Memory {
4
}
5
6
write (offset, length, value) {
7
+ // Grow if needed
8
+ if (this._raw.buffer.byteLength < length) {
9
+ const diff = length - this._raw.buffer.byteLength
10
+ const pageSize = 64 * 1024
11
+ this._raw.grow(Math.ceil(diff / pageSize))
12
+ }
13
+
14
const m = new Uint8Array(this._raw.buffer, offset, length)
15
m.set(value)
16
0 commit comments