From 8f7f9f3e2014d5526918677a724d2376bbfbfe8d Mon Sep 17 00:00:00 2001 From: Brian Ben Maranville Date: Mon, 2 May 2022 11:51:30 -0400 Subject: [PATCH] return string from struct.unpack... for string types --- esm/core.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esm/core.js b/esm/core.js index 6a92ccb..2a6f0a3 100644 --- a/esm/core.js +++ b/esm/core.js @@ -136,9 +136,8 @@ class Struct { let f = match[2]; let getter = this.getters[f]; let size = this.byte_lengths[f]; - var append_target; if (f == 's') { - output.push(buffer.slice(offset, offset + n)); + output.push(new TextDecoder().decode(buffer.slice(offset, offset + n))); offset += n; } else {