@k67/kaitai-struct-ts 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -6
- package/dist/cli.js +16 -3
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -21
package/dist/index.mjs
CHANGED
@@ -2305,7 +2305,14 @@ var TypeInterpreter = class _TypeInterpreter {
|
|
2305
2305
|
return this.readFloat(base, endian, stream);
|
2306
2306
|
}
|
2307
2307
|
if (isStringType(type)) {
|
2308
|
-
|
2308
|
+
const encoding = this.schema.meta?.encoding || "UTF-8";
|
2309
|
+
if (type === "strz") {
|
2310
|
+
return stream.readStrz(encoding, 0, false, true, true);
|
2311
|
+
} else if (type === "str") {
|
2312
|
+
throw new ParseError(
|
2313
|
+
"str type requires size, size-eos, or terminator attribute"
|
2314
|
+
);
|
2315
|
+
}
|
2309
2316
|
}
|
2310
2317
|
throw new ParseError(`Unknown built-in type: ${type}`);
|
2311
2318
|
}
|