Skip to content

Commit 632c589

Browse files
authored
Merge pull request #151 from ziggi/node23fix
Fix for Node v23+
2 parents 3926286 + 6333a2f commit 632c589

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class Packr extends Unpackr {
2828
let structures
2929
let referenceMap
3030
let encodeUtf8 = ByteArray.prototype.utf8Write ? function(string, position) {
31-
return target.utf8Write(string, position, 0xffffffff)
31+
return target.utf8Write(string, position, target.byteLength - position)
3232
} : (textEncoder && textEncoder.encodeInto) ?
3333
function(string, position) {
3434
return textEncoder.encodeInto(string, target.subarray(position)).written

struct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ try {
6060
textEncoder = new TextEncoder()
6161
} catch (error) {}
6262
const encodeUtf8 = hasNodeBuffer ? function(target, string, position) {
63-
return target.utf8Write(string, position, 0xffffffff)
63+
return target.utf8Write(string, position, target.byteLength - position)
6464
} : (textEncoder && textEncoder.encodeInto) ?
6565
function(target, string, position) {
6666
return textEncoder.encodeInto(string, target.subarray(position)).written

0 commit comments

Comments
 (0)