1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Add a new BaseStream.getString(...) method to replace manual bytesToString(BaseStream.getBytes(...)) calls

Given that the `bytesToString(BaseStream.getBytes(...))` pattern is somewhat common throughout the `src/core/` code, it cannot hurt to add a new `BaseStream`-method which handles that case internally.
This commit is contained in:
Jonas Jenwald 2021-05-01 12:11:09 +02:00
parent f6f335173d
commit 3624f9eac7
6 changed files with 33 additions and 32 deletions

View file

@ -16,7 +16,6 @@
import {
assert,
BaseException,
bytesToString,
objectSize,
stringToPDFString,
warn,
@ -269,7 +268,7 @@ function _collectJS(entry, xref, list, parents) {
const js = entry.get("JS");
let code;
if (isStream(js)) {
code = bytesToString(js.getBytes());
code = js.getString();
} else {
code = js;
}