js.documents 14.4.46 → 14.4.47
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/dist/convert/composition.cjs +9 -4
- package/dist/convert/composition.js +9 -4
- package/dist/convert/variant-bridges.cjs +2 -1
- package/dist/convert/variant-bridges.js +2 -1
- package/dist/csv/records.cjs +2 -1
- package/dist/csv/records.js +2 -1
- package/dist/edit/geometry.cjs +2 -1
- package/dist/edit/geometry.js +2 -1
- package/dist/edit/odg/svg-path.cjs +2 -1
- package/dist/edit/odg/svg-path.js +2 -1
- package/dist/edit/ods/cell.cjs +2 -1
- package/dist/edit/ods/cell.js +2 -1
- package/dist/edit/pdf/util.cjs +2 -1
- package/dist/edit/pdf/util.js +2 -1
- package/dist/firebird/data.cjs +2 -1
- package/dist/firebird/data.js +2 -1
- package/dist/firebird/date.cjs +40 -21
- package/dist/firebird/date.js +40 -21
- package/dist/firebird/reader.cjs +30 -19
- package/dist/firebird/reader.js +30 -19
- package/dist/hsqldb/binary-script.cjs +5 -4
- package/dist/hsqldb/binary-script.js +5 -4
- package/dist/hsqldb/cache.cjs +4 -2
- package/dist/hsqldb/cache.js +4 -2
- package/dist/hsqldb/rowformat.cjs +93 -57
- package/dist/hsqldb/rowformat.js +93 -57
- package/dist/hsqldb/script.cjs +2 -1
- package/dist/hsqldb/script.js +2 -1
- package/dist/latex/lower.cjs +2 -1
- package/dist/latex/lower.js +2 -1
- package/dist/latex/rational.cjs +6 -3
- package/dist/latex/rational.js +6 -3
- package/dist/layout/cell-typing.cjs +7 -3
- package/dist/layout/cell-typing.js +7 -3
- package/dist/layout/reconstruct.cjs +17 -15
- package/dist/layout/reconstruct.js +17 -15
- package/dist/layout/shared.cjs +2 -1
- package/dist/layout/shared.js +2 -1
- package/dist/layout/sheets.cjs +2 -1
- package/dist/layout/sheets.js +2 -1
- package/dist/mathml/layout.cjs +11 -5
- package/dist/mathml/layout.js +11 -5
- package/dist/mathml/length.cjs +12 -10
- package/dist/mathml/length.js +12 -10
- package/dist/mathml/operators.cjs +7 -3
- package/dist/mathml/operators.js +7 -3
- package/dist/mathml/variant.cjs +116 -1142
- package/dist/mathml/variant.js +116 -1142
- package/dist/model/bytes.cjs +9 -16
- package/dist/model/bytes.js +9 -16
- package/dist/model/geometry.cjs +2 -1
- package/dist/model/geometry.js +2 -1
- package/dist/odb/read.cjs +10 -2
- package/dist/odb/read.js +10 -2
- package/dist/svg/paint.cjs +177 -749
- package/dist/svg/paint.js +177 -749
- package/dist/svg/path.cjs +11 -6
- package/dist/svg/path.js +11 -6
- package/dist/svg/read.cjs +7 -3
- package/dist/svg/read.js +8 -4
- package/dist/svg/transform.cjs +11 -7
- package/dist/svg/transform.js +11 -7
- package/dist/svg/units.cjs +9 -5
- package/dist/svg/units.d.cts +2 -1
- package/dist/svg/units.d.ts +2 -1
- package/dist/svg/units.js +9 -6
- package/package.json +2 -2
|
@@ -39,6 +39,11 @@ require("markdown-codec");
|
|
|
39
39
|
let wpd_codec = require("wpd-codec");
|
|
40
40
|
let pdf_codec_read = require("pdf-codec/read");
|
|
41
41
|
//#region src/convert/composition.ts
|
|
42
|
+
const LATIN1_MAX_CODE = 255;
|
|
43
|
+
const HEX_RADIX = 16;
|
|
44
|
+
const UNICODE_HEX_DIGITS = 4;
|
|
45
|
+
const THROUGH_PDF_EDGE_COST = 3;
|
|
46
|
+
const MAX_CONVERSION_PATH_NODES = 4;
|
|
42
47
|
const FORMAT_NODES = {
|
|
43
48
|
docx: {
|
|
44
49
|
variant: "wordprocessing",
|
|
@@ -263,7 +268,7 @@ function latin1ToBytes(text) {
|
|
|
263
268
|
const bytes = new Uint8Array(text.length);
|
|
264
269
|
for (let index = 0; index < text.length; index += 1) {
|
|
265
270
|
const code = text.charCodeAt(index);
|
|
266
|
-
if (code >
|
|
271
|
+
if (code > LATIN1_MAX_CODE) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(HEX_RADIX).toUpperCase().padStart(UNICODE_HEX_DIGITS, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
|
|
267
272
|
bytes[index] = code;
|
|
268
273
|
}
|
|
269
274
|
return bytes;
|
|
@@ -392,7 +397,7 @@ function buildCompositionGraph() {
|
|
|
392
397
|
}
|
|
393
398
|
}
|
|
394
399
|
}
|
|
395
|
-
for (const format of CONTENT_FORMATS) if (LAYOUT_CAPABLE.has(format)) addEdge(format, "pdf",
|
|
400
|
+
for (const format of CONTENT_FORMATS) if (LAYOUT_CAPABLE.has(format)) addEdge(format, "pdf", THROUGH_PDF_EDGE_COST);
|
|
396
401
|
for (const source of READ_ONLY_CONTENT_FORMATS) {
|
|
397
402
|
const variant = READ_ONLY_FORMAT_NODES[source].variant;
|
|
398
403
|
for (const target of CONTENT_FORMATS) {
|
|
@@ -400,7 +405,7 @@ function buildCompositionGraph() {
|
|
|
400
405
|
if (targetVariant === variant) addDirected(source, target, 1);
|
|
401
406
|
else if (TRANSFORMS[`${variant}->${targetVariant}`] !== void 0) addDirected(source, target, 2);
|
|
402
407
|
}
|
|
403
|
-
if (LAYOUT_CAPABLE.has(source)) addDirected(source, "pdf",
|
|
408
|
+
if (LAYOUT_CAPABLE.has(source)) addDirected(source, "pdf", THROUGH_PDF_EDGE_COST);
|
|
404
409
|
}
|
|
405
410
|
return adj;
|
|
406
411
|
}
|
|
@@ -441,7 +446,7 @@ function shortestPath(source, target) {
|
|
|
441
446
|
function resolveCompositionPlan(source, target) {
|
|
442
447
|
const path = shortestPath(source, target);
|
|
443
448
|
if (path === void 0) return;
|
|
444
|
-
if (path.length >
|
|
449
|
+
if (path.length > MAX_CONVERSION_PATH_NODES) return;
|
|
445
450
|
const hops = [];
|
|
446
451
|
for (let i = 0; i + 1 < path.length; i++) {
|
|
447
452
|
const from = path[i];
|
|
@@ -38,6 +38,11 @@ import "markdown-codec";
|
|
|
38
38
|
import { readWpdContent } from "wpd-codec";
|
|
39
39
|
import { readPdf } from "pdf-codec/read";
|
|
40
40
|
//#region src/convert/composition.ts
|
|
41
|
+
const LATIN1_MAX_CODE = 255;
|
|
42
|
+
const HEX_RADIX = 16;
|
|
43
|
+
const UNICODE_HEX_DIGITS = 4;
|
|
44
|
+
const THROUGH_PDF_EDGE_COST = 3;
|
|
45
|
+
const MAX_CONVERSION_PATH_NODES = 4;
|
|
41
46
|
const FORMAT_NODES = {
|
|
42
47
|
docx: {
|
|
43
48
|
variant: "wordprocessing",
|
|
@@ -262,7 +267,7 @@ function latin1ToBytes(text) {
|
|
|
262
267
|
const bytes = new Uint8Array(text.length);
|
|
263
268
|
for (let index = 0; index < text.length; index += 1) {
|
|
264
269
|
const code = text.charCodeAt(index);
|
|
265
|
-
if (code >
|
|
270
|
+
if (code > LATIN1_MAX_CODE) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(HEX_RADIX).toUpperCase().padStart(UNICODE_HEX_DIGITS, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
|
|
266
271
|
bytes[index] = code;
|
|
267
272
|
}
|
|
268
273
|
return bytes;
|
|
@@ -391,7 +396,7 @@ function buildCompositionGraph() {
|
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
398
|
}
|
|
394
|
-
for (const format of CONTENT_FORMATS) if (LAYOUT_CAPABLE.has(format)) addEdge(format, "pdf",
|
|
399
|
+
for (const format of CONTENT_FORMATS) if (LAYOUT_CAPABLE.has(format)) addEdge(format, "pdf", THROUGH_PDF_EDGE_COST);
|
|
395
400
|
for (const source of READ_ONLY_CONTENT_FORMATS) {
|
|
396
401
|
const variant = READ_ONLY_FORMAT_NODES[source].variant;
|
|
397
402
|
for (const target of CONTENT_FORMATS) {
|
|
@@ -399,7 +404,7 @@ function buildCompositionGraph() {
|
|
|
399
404
|
if (targetVariant === variant) addDirected(source, target, 1);
|
|
400
405
|
else if (TRANSFORMS[`${variant}->${targetVariant}`] !== void 0) addDirected(source, target, 2);
|
|
401
406
|
}
|
|
402
|
-
if (LAYOUT_CAPABLE.has(source)) addDirected(source, "pdf",
|
|
407
|
+
if (LAYOUT_CAPABLE.has(source)) addDirected(source, "pdf", THROUGH_PDF_EDGE_COST);
|
|
403
408
|
}
|
|
404
409
|
return adj;
|
|
405
410
|
}
|
|
@@ -440,7 +445,7 @@ function shortestPath(source, target) {
|
|
|
440
445
|
function resolveCompositionPlan(source, target) {
|
|
441
446
|
const path = shortestPath(source, target);
|
|
442
447
|
if (path === void 0) return;
|
|
443
|
-
if (path.length >
|
|
448
|
+
if (path.length > MAX_CONVERSION_PATH_NODES) return;
|
|
444
449
|
const hops = [];
|
|
445
450
|
for (let i = 0; i + 1 < path.length; i++) {
|
|
446
451
|
const from = path[i];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let document_schema_js = require("document-schema.js");
|
|
3
3
|
//#region src/convert/variant-bridges.ts
|
|
4
|
+
const DEFAULT_COLUMN_WIDTH_PT = 72;
|
|
4
5
|
const DEFAULT_INSET_LEFT_PT = 9.14;
|
|
5
6
|
const DEFAULT_INSET_TOP_PT = 4.57;
|
|
6
7
|
const DEFAULT_INSET_RIGHT_PT = 9.14;
|
|
@@ -120,7 +121,7 @@ function sheetToTableBlock(sheet) {
|
|
|
120
121
|
const visibleColumns = [];
|
|
121
122
|
for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
|
|
122
123
|
const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
|
|
123
|
-
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ??
|
|
124
|
+
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
|
|
124
125
|
return {
|
|
125
126
|
kind: "table",
|
|
126
127
|
rows: visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) })),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PAGE_SIZE_A4, SLIDE_SIZE_WIDESCREEN } from "document-schema.js";
|
|
2
2
|
//#region src/convert/variant-bridges.ts
|
|
3
|
+
const DEFAULT_COLUMN_WIDTH_PT = 72;
|
|
3
4
|
const DEFAULT_INSET_LEFT_PT = 9.14;
|
|
4
5
|
const DEFAULT_INSET_TOP_PT = 4.57;
|
|
5
6
|
const DEFAULT_INSET_RIGHT_PT = 9.14;
|
|
@@ -119,7 +120,7 @@ function sheetToTableBlock(sheet) {
|
|
|
119
120
|
const visibleColumns = [];
|
|
120
121
|
for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
|
|
121
122
|
const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
|
|
122
|
-
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ??
|
|
123
|
+
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
|
|
123
124
|
return {
|
|
124
125
|
kind: "table",
|
|
125
126
|
rows: visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) })),
|
package/dist/csv/records.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/csv/records.ts
|
|
3
|
+
const FIELD_PREVIEW_LENGTH = 40;
|
|
3
4
|
const DEFAULT_CSV_DELIMITER = ",";
|
|
4
5
|
const TSV_DELIMITER = " ";
|
|
5
6
|
var CsvParseError = class extends Error {
|
|
@@ -70,7 +71,7 @@ function parseCsvRecords(text, delimiter = ",") {
|
|
|
70
71
|
fieldStarted = true;
|
|
71
72
|
index += 1;
|
|
72
73
|
}
|
|
73
|
-
if (inQuotedField) throw new CsvParseError(`unterminated quoted field: no closing double quote before end of input (field so far: ${field.slice(0,
|
|
74
|
+
if (inQuotedField) throw new CsvParseError(`unterminated quoted field: no closing double quote before end of input (field so far: ${field.slice(0, FIELD_PREVIEW_LENGTH)})`);
|
|
74
75
|
if (fieldStarted || field !== "" || record.length > 0) endRecord();
|
|
75
76
|
return records.filter((candidate) => !isBlankRecord(candidate));
|
|
76
77
|
}
|
package/dist/csv/records.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/csv/records.ts
|
|
2
|
+
const FIELD_PREVIEW_LENGTH = 40;
|
|
2
3
|
const DEFAULT_CSV_DELIMITER = ",";
|
|
3
4
|
const TSV_DELIMITER = " ";
|
|
4
5
|
var CsvParseError = class extends Error {
|
|
@@ -69,7 +70,7 @@ function parseCsvRecords(text, delimiter = ",") {
|
|
|
69
70
|
fieldStarted = true;
|
|
70
71
|
index += 1;
|
|
71
72
|
}
|
|
72
|
-
if (inQuotedField) throw new CsvParseError(`unterminated quoted field: no closing double quote before end of input (field so far: ${field.slice(0,
|
|
73
|
+
if (inQuotedField) throw new CsvParseError(`unterminated quoted field: no closing double quote before end of input (field so far: ${field.slice(0, FIELD_PREVIEW_LENGTH)})`);
|
|
73
74
|
if (fieldStarted || field !== "" || record.length > 0) endRecord();
|
|
74
75
|
return records.filter((candidate) => !isBlankRecord(candidate));
|
|
75
76
|
}
|
package/dist/edit/geometry.cjs
CHANGED
|
@@ -2,8 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_edit = require("../xml/edit.cjs");
|
|
3
3
|
let odf_js = require("odf.js");
|
|
4
4
|
//#region src/edit/geometry.ts
|
|
5
|
+
const PI_RADIANS_IN_DEGREES = 180;
|
|
5
6
|
function buildTransformAttr(frame, rotationDeg) {
|
|
6
|
-
const angleRad = -rotationDeg * Math.PI /
|
|
7
|
+
const angleRad = -rotationDeg * Math.PI / PI_RADIANS_IN_DEGREES;
|
|
7
8
|
const localCenter = {
|
|
8
9
|
xPt: frame.widthPt / 2,
|
|
9
10
|
yPt: frame.heightPt / 2
|
package/dist/edit/geometry.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { removeAttr, setAttr } from "../xml/edit.js";
|
|
2
2
|
import { applyOdfTransform, formatOdfLength } from "odf.js";
|
|
3
3
|
//#region src/edit/geometry.ts
|
|
4
|
+
const PI_RADIANS_IN_DEGREES = 180;
|
|
4
5
|
function buildTransformAttr(frame, rotationDeg) {
|
|
5
|
-
const angleRad = -rotationDeg * Math.PI /
|
|
6
|
+
const angleRad = -rotationDeg * Math.PI / PI_RADIANS_IN_DEGREES;
|
|
6
7
|
const localCenter = {
|
|
7
8
|
xPt: frame.widthPt / 2,
|
|
8
9
|
yPt: frame.heightPt / 2
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/edit/odg/svg-path.ts
|
|
3
|
+
const DECIMAL_RADIX = 10;
|
|
3
4
|
const PATH_NUMBER_DECIMALS = 6;
|
|
4
|
-
const PATH_NUMBER_SCALE =
|
|
5
|
+
const PATH_NUMBER_SCALE = DECIMAL_RADIX ** PATH_NUMBER_DECIMALS;
|
|
5
6
|
function formatPathNumber(value) {
|
|
6
7
|
if (!Number.isFinite(value)) throw new Error(`cannot format a non-finite path coordinate: ${value}`);
|
|
7
8
|
return (Math.round(value * PATH_NUMBER_SCALE) / PATH_NUMBER_SCALE).toFixed(PATH_NUMBER_DECIMALS).replace(/0+$/, "").replace(/\.$/, "");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/edit/odg/svg-path.ts
|
|
2
|
+
const DECIMAL_RADIX = 10;
|
|
2
3
|
const PATH_NUMBER_DECIMALS = 6;
|
|
3
|
-
const PATH_NUMBER_SCALE =
|
|
4
|
+
const PATH_NUMBER_SCALE = DECIMAL_RADIX ** PATH_NUMBER_DECIMALS;
|
|
4
5
|
function formatPathNumber(value) {
|
|
5
6
|
if (!Number.isFinite(value)) throw new Error(`cannot format a non-finite path coordinate: ${value}`);
|
|
6
7
|
return (Math.round(value * PATH_NUMBER_SCALE) / PATH_NUMBER_SCALE).toFixed(PATH_NUMBER_DECIMALS).replace(/0+$/, "").replace(/\.$/, "");
|
package/dist/edit/ods/cell.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
|
|
|
6
6
|
const require_edit_odt_content = require("../odt/content.cjs");
|
|
7
7
|
let ooxml_js = require("ooxml.js");
|
|
8
8
|
//#region src/edit/ods/cell.ts
|
|
9
|
+
const PERCENT_SCALE = 100;
|
|
9
10
|
const VALUE_TYPE_ATTR = "office:value-type";
|
|
10
11
|
const VALUE_ATTR = "office:value";
|
|
11
12
|
const BOOLEAN_VALUE_ATTR = "office:boolean-value";
|
|
@@ -111,7 +112,7 @@ var OdsCell = class {
|
|
|
111
112
|
case "percentage":
|
|
112
113
|
require_xml_edit.setAttr(this.node, VALUE_TYPE_ATTR, "percentage");
|
|
113
114
|
require_xml_edit.setAttr(this.node, VALUE_ATTR, String(value.value));
|
|
114
|
-
this.displayText = `${value.value *
|
|
115
|
+
this.displayText = `${value.value * PERCENT_SCALE}%`;
|
|
115
116
|
break;
|
|
116
117
|
case "currency":
|
|
117
118
|
require_xml_edit.setAttr(this.node, VALUE_TYPE_ATTR, "currency");
|
package/dist/edit/ods/cell.js
CHANGED
|
@@ -5,6 +5,7 @@ import { OdtParagraph } from "../odt/paragraph.js";
|
|
|
5
5
|
import { populateParagraph } from "../odt/content.js";
|
|
6
6
|
import { attr } from "ooxml.js";
|
|
7
7
|
//#region src/edit/ods/cell.ts
|
|
8
|
+
const PERCENT_SCALE = 100;
|
|
8
9
|
const VALUE_TYPE_ATTR = "office:value-type";
|
|
9
10
|
const VALUE_ATTR = "office:value";
|
|
10
11
|
const BOOLEAN_VALUE_ATTR = "office:boolean-value";
|
|
@@ -110,7 +111,7 @@ var OdsCell = class {
|
|
|
110
111
|
case "percentage":
|
|
111
112
|
setAttr(this.node, VALUE_TYPE_ATTR, "percentage");
|
|
112
113
|
setAttr(this.node, VALUE_ATTR, String(value.value));
|
|
113
|
-
this.displayText = `${value.value *
|
|
114
|
+
this.displayText = `${value.value * PERCENT_SCALE}%`;
|
|
114
115
|
break;
|
|
115
116
|
case "currency":
|
|
116
117
|
setAttr(this.node, VALUE_TYPE_ATTR, "currency");
|
package/dist/edit/pdf/util.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let ooxml_js = require("ooxml.js");
|
|
3
3
|
let byte_codec = require("byte-codec");
|
|
4
4
|
//#region src/edit/pdf/util.ts
|
|
5
|
+
const HEX_RADIX = 16;
|
|
5
6
|
function spliceOut(container, node) {
|
|
6
7
|
const index = container.indexOf(node);
|
|
7
8
|
if (index !== -1) container.splice(index, 1);
|
|
@@ -21,7 +22,7 @@ function decodeImageDimensions(format, bytes) {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
function registerImageBytes(bytes, format, images) {
|
|
24
|
-
const imageId = `img${(0, byte_codec.crc32)(bytes).toString(
|
|
25
|
+
const imageId = `img${(0, byte_codec.crc32)(bytes).toString(HEX_RADIX)}`;
|
|
25
26
|
if (!(imageId in images)) {
|
|
26
27
|
const { widthPx, heightPx } = decodeImageDimensions(format, bytes);
|
|
27
28
|
images[imageId] = {
|
package/dist/edit/pdf/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bytesToBase64 } from "ooxml.js";
|
|
2
2
|
import { crc32, decodePng, readJpegInfo } from "byte-codec";
|
|
3
3
|
//#region src/edit/pdf/util.ts
|
|
4
|
+
const HEX_RADIX = 16;
|
|
4
5
|
function spliceOut(container, node) {
|
|
5
6
|
const index = container.indexOf(node);
|
|
6
7
|
if (index !== -1) container.splice(index, 1);
|
|
@@ -20,7 +21,7 @@ function decodeImageDimensions(format, bytes) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
function registerImageBytes(bytes, format, images) {
|
|
23
|
-
const imageId = `img${crc32(bytes).toString(
|
|
24
|
+
const imageId = `img${crc32(bytes).toString(HEX_RADIX)}`;
|
|
24
25
|
if (!(imageId in images)) {
|
|
25
26
|
const { widthPx, heightPx } = decodeImageDimensions(format, bytes);
|
|
26
27
|
images[imageId] = {
|
package/dist/firebird/data.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_firebird_reader = require("./reader.cjs");
|
|
|
3
3
|
const require_firebird_date = require("./date.cjs");
|
|
4
4
|
let byte_codec = require("byte-codec");
|
|
5
5
|
//#region src/firebird/data.ts
|
|
6
|
+
const BIGINT_ZERO = 0n;
|
|
6
7
|
const REC_DATA = 6;
|
|
7
8
|
const REC_BLOB = 7;
|
|
8
9
|
const REC_RELATION_END = 9;
|
|
@@ -76,7 +77,7 @@ function storedFieldsOf(fields) {
|
|
|
76
77
|
return fields.filter((field) => !field.computed);
|
|
77
78
|
}
|
|
78
79
|
function exactDecimalDigits(unscaled, decimalScale) {
|
|
79
|
-
const isNegative = unscaled <
|
|
80
|
+
const isNegative = unscaled < BIGINT_ZERO;
|
|
80
81
|
const magnitudeDigits = (isNegative ? -unscaled : unscaled).toString();
|
|
81
82
|
const sign = isNegative ? "-" : "";
|
|
82
83
|
if (decimalScale <= 0) return `${sign}${magnitudeDigits}${"0".repeat(-decimalScale)}`;
|
package/dist/firebird/data.js
CHANGED
|
@@ -2,6 +2,7 @@ import { XdrReader } from "./reader.js";
|
|
|
2
2
|
import { formatFirebirdDate, formatFirebirdTime, formatFirebirdTimestamp } from "./date.js";
|
|
3
3
|
import { bytesToBase64 } from "byte-codec";
|
|
4
4
|
//#region src/firebird/data.ts
|
|
5
|
+
const BIGINT_ZERO = 0n;
|
|
5
6
|
const REC_DATA = 6;
|
|
6
7
|
const REC_BLOB = 7;
|
|
7
8
|
const REC_RELATION_END = 9;
|
|
@@ -75,7 +76,7 @@ function storedFieldsOf(fields) {
|
|
|
75
76
|
return fields.filter((field) => !field.computed);
|
|
76
77
|
}
|
|
77
78
|
function exactDecimalDigits(unscaled, decimalScale) {
|
|
78
|
-
const isNegative = unscaled <
|
|
79
|
+
const isNegative = unscaled < BIGINT_ZERO;
|
|
79
80
|
const magnitudeDigits = (isNegative ? -unscaled : unscaled).toString();
|
|
80
81
|
const sign = isNegative ? "-" : "";
|
|
81
82
|
if (decimalScale <= 0) return `${sign}${magnitudeDigits}${"0".repeat(-decimalScale)}`;
|
package/dist/firebird/date.cjs
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/firebird/date.ts
|
|
3
3
|
const ISC_TIME_SECONDS_PRECISION = 1e4;
|
|
4
|
+
const FIREBIRD_MJD_EPOCH_OFFSET = 2400001;
|
|
5
|
+
const JULIAN_DAY_CIVIL_EPOCH_OFFSET = 1721119;
|
|
6
|
+
const DAYS_PER_400_YEARS = 146097;
|
|
7
|
+
const DAYS_PER_4_YEARS = 1461;
|
|
8
|
+
const DAYS_PER_5_MONTHS_FROM_MARCH = 153;
|
|
9
|
+
const QUAD_SCALE = 4;
|
|
10
|
+
const QUAD_ROUND = 3;
|
|
11
|
+
const QUINT_SCALE = 5;
|
|
12
|
+
const QUINT_ROUND = 3;
|
|
13
|
+
const CENTURY_TO_YEAR_SCALE = 100;
|
|
14
|
+
const MARCH_BASED_MONTH_COUNT = 10;
|
|
15
|
+
const MARCH_MONTH_OFFSET = 3;
|
|
16
|
+
const JANUARY_MONTH_OFFSET = 9;
|
|
4
17
|
function decodeFirebirdDate(days) {
|
|
5
|
-
let nday = days +
|
|
6
|
-
const century = Math.floor((
|
|
7
|
-
nday =
|
|
8
|
-
let day = Math.floor(nday /
|
|
9
|
-
nday = Math.floor((
|
|
10
|
-
day =
|
|
11
|
-
day = Math.floor((day +
|
|
12
|
-
let month = Math.floor((
|
|
13
|
-
day =
|
|
14
|
-
day = Math.floor((day +
|
|
15
|
-
let year =
|
|
16
|
-
if (month <
|
|
18
|
+
let nday = days + FIREBIRD_MJD_EPOCH_OFFSET - JULIAN_DAY_CIVIL_EPOCH_OFFSET;
|
|
19
|
+
const century = Math.floor((QUAD_SCALE * nday - 1) / DAYS_PER_400_YEARS);
|
|
20
|
+
nday = QUAD_SCALE * nday - 1 - DAYS_PER_400_YEARS * century;
|
|
21
|
+
let day = Math.floor(nday / QUAD_SCALE);
|
|
22
|
+
nday = Math.floor((QUAD_SCALE * day + QUAD_ROUND) / DAYS_PER_4_YEARS);
|
|
23
|
+
day = QUAD_SCALE * day + QUAD_ROUND - DAYS_PER_4_YEARS * nday;
|
|
24
|
+
day = Math.floor((day + QUAD_SCALE) / QUAD_SCALE);
|
|
25
|
+
let month = Math.floor((QUINT_SCALE * day - QUINT_ROUND) / DAYS_PER_5_MONTHS_FROM_MARCH);
|
|
26
|
+
day = QUINT_SCALE * day - QUINT_ROUND - DAYS_PER_5_MONTHS_FROM_MARCH * month;
|
|
27
|
+
day = Math.floor((day + QUINT_SCALE) / QUINT_SCALE);
|
|
28
|
+
let year = CENTURY_TO_YEAR_SCALE * century + nday;
|
|
29
|
+
if (month < MARCH_BASED_MONTH_COUNT) month += MARCH_MONTH_OFFSET;
|
|
17
30
|
else {
|
|
18
|
-
month -=
|
|
31
|
+
month -= JANUARY_MONTH_OFFSET;
|
|
19
32
|
year += 1;
|
|
20
33
|
}
|
|
21
34
|
return {
|
|
@@ -24,12 +37,14 @@ function decodeFirebirdDate(days) {
|
|
|
24
37
|
day
|
|
25
38
|
};
|
|
26
39
|
}
|
|
40
|
+
const SECONDS_PER_HOUR = 3600;
|
|
41
|
+
const SECONDS_PER_MINUTE = 60;
|
|
27
42
|
function decodeFirebirdTime(ticks) {
|
|
28
43
|
let remaining = ticks;
|
|
29
|
-
const hours = Math.floor(remaining / (
|
|
30
|
-
remaining %=
|
|
31
|
-
const minutes = Math.floor(remaining / (
|
|
32
|
-
remaining %=
|
|
44
|
+
const hours = Math.floor(remaining / (SECONDS_PER_HOUR * ISC_TIME_SECONDS_PRECISION));
|
|
45
|
+
remaining %= SECONDS_PER_HOUR * ISC_TIME_SECONDS_PRECISION;
|
|
46
|
+
const minutes = Math.floor(remaining / (SECONDS_PER_MINUTE * ISC_TIME_SECONDS_PRECISION));
|
|
47
|
+
remaining %= SECONDS_PER_MINUTE * ISC_TIME_SECONDS_PRECISION;
|
|
33
48
|
return {
|
|
34
49
|
hours,
|
|
35
50
|
minutes,
|
|
@@ -37,11 +52,15 @@ function decodeFirebirdTime(ticks) {
|
|
|
37
52
|
fractions: remaining % ISC_TIME_SECONDS_PRECISION
|
|
38
53
|
};
|
|
39
54
|
}
|
|
55
|
+
const CLOCK_DIGIT_WIDTH = 2;
|
|
56
|
+
const YEAR_DIGIT_WIDTH = 4;
|
|
57
|
+
const MILLIS_DIGIT_WIDTH = 3;
|
|
58
|
+
const TICKS_PER_MILLISECOND = 10;
|
|
40
59
|
function pad2(value) {
|
|
41
|
-
return String(value).padStart(
|
|
60
|
+
return String(value).padStart(CLOCK_DIGIT_WIDTH, "0");
|
|
42
61
|
}
|
|
43
62
|
function pad4(value) {
|
|
44
|
-
return String(value).padStart(
|
|
63
|
+
return String(value).padStart(YEAR_DIGIT_WIDTH, "0");
|
|
45
64
|
}
|
|
46
65
|
function formatFirebirdDate(days) {
|
|
47
66
|
const { year, month, day } = decodeFirebirdDate(days);
|
|
@@ -49,8 +68,8 @@ function formatFirebirdDate(days) {
|
|
|
49
68
|
}
|
|
50
69
|
function formatFirebirdTime(ticks) {
|
|
51
70
|
const { hours, minutes, seconds, fractions } = decodeFirebirdTime(ticks);
|
|
52
|
-
const millis = Math.round(fractions /
|
|
53
|
-
return `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}.${String(millis).padStart(
|
|
71
|
+
const millis = Math.round(fractions / TICKS_PER_MILLISECOND);
|
|
72
|
+
return `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}.${String(millis).padStart(MILLIS_DIGIT_WIDTH, "0")}`;
|
|
54
73
|
}
|
|
55
74
|
function formatFirebirdTimestamp(days, ticks) {
|
|
56
75
|
return `${formatFirebirdDate(days)} ${formatFirebirdTime(ticks)}`;
|
package/dist/firebird/date.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
//#region src/firebird/date.ts
|
|
2
2
|
const ISC_TIME_SECONDS_PRECISION = 1e4;
|
|
3
|
+
const FIREBIRD_MJD_EPOCH_OFFSET = 2400001;
|
|
4
|
+
const JULIAN_DAY_CIVIL_EPOCH_OFFSET = 1721119;
|
|
5
|
+
const DAYS_PER_400_YEARS = 146097;
|
|
6
|
+
const DAYS_PER_4_YEARS = 1461;
|
|
7
|
+
const DAYS_PER_5_MONTHS_FROM_MARCH = 153;
|
|
8
|
+
const QUAD_SCALE = 4;
|
|
9
|
+
const QUAD_ROUND = 3;
|
|
10
|
+
const QUINT_SCALE = 5;
|
|
11
|
+
const QUINT_ROUND = 3;
|
|
12
|
+
const CENTURY_TO_YEAR_SCALE = 100;
|
|
13
|
+
const MARCH_BASED_MONTH_COUNT = 10;
|
|
14
|
+
const MARCH_MONTH_OFFSET = 3;
|
|
15
|
+
const JANUARY_MONTH_OFFSET = 9;
|
|
3
16
|
function decodeFirebirdDate(days) {
|
|
4
|
-
let nday = days +
|
|
5
|
-
const century = Math.floor((
|
|
6
|
-
nday =
|
|
7
|
-
let day = Math.floor(nday /
|
|
8
|
-
nday = Math.floor((
|
|
9
|
-
day =
|
|
10
|
-
day = Math.floor((day +
|
|
11
|
-
let month = Math.floor((
|
|
12
|
-
day =
|
|
13
|
-
day = Math.floor((day +
|
|
14
|
-
let year =
|
|
15
|
-
if (month <
|
|
17
|
+
let nday = days + FIREBIRD_MJD_EPOCH_OFFSET - JULIAN_DAY_CIVIL_EPOCH_OFFSET;
|
|
18
|
+
const century = Math.floor((QUAD_SCALE * nday - 1) / DAYS_PER_400_YEARS);
|
|
19
|
+
nday = QUAD_SCALE * nday - 1 - DAYS_PER_400_YEARS * century;
|
|
20
|
+
let day = Math.floor(nday / QUAD_SCALE);
|
|
21
|
+
nday = Math.floor((QUAD_SCALE * day + QUAD_ROUND) / DAYS_PER_4_YEARS);
|
|
22
|
+
day = QUAD_SCALE * day + QUAD_ROUND - DAYS_PER_4_YEARS * nday;
|
|
23
|
+
day = Math.floor((day + QUAD_SCALE) / QUAD_SCALE);
|
|
24
|
+
let month = Math.floor((QUINT_SCALE * day - QUINT_ROUND) / DAYS_PER_5_MONTHS_FROM_MARCH);
|
|
25
|
+
day = QUINT_SCALE * day - QUINT_ROUND - DAYS_PER_5_MONTHS_FROM_MARCH * month;
|
|
26
|
+
day = Math.floor((day + QUINT_SCALE) / QUINT_SCALE);
|
|
27
|
+
let year = CENTURY_TO_YEAR_SCALE * century + nday;
|
|
28
|
+
if (month < MARCH_BASED_MONTH_COUNT) month += MARCH_MONTH_OFFSET;
|
|
16
29
|
else {
|
|
17
|
-
month -=
|
|
30
|
+
month -= JANUARY_MONTH_OFFSET;
|
|
18
31
|
year += 1;
|
|
19
32
|
}
|
|
20
33
|
return {
|
|
@@ -23,12 +36,14 @@ function decodeFirebirdDate(days) {
|
|
|
23
36
|
day
|
|
24
37
|
};
|
|
25
38
|
}
|
|
39
|
+
const SECONDS_PER_HOUR = 3600;
|
|
40
|
+
const SECONDS_PER_MINUTE = 60;
|
|
26
41
|
function decodeFirebirdTime(ticks) {
|
|
27
42
|
let remaining = ticks;
|
|
28
|
-
const hours = Math.floor(remaining / (
|
|
29
|
-
remaining %=
|
|
30
|
-
const minutes = Math.floor(remaining / (
|
|
31
|
-
remaining %=
|
|
43
|
+
const hours = Math.floor(remaining / (SECONDS_PER_HOUR * ISC_TIME_SECONDS_PRECISION));
|
|
44
|
+
remaining %= SECONDS_PER_HOUR * ISC_TIME_SECONDS_PRECISION;
|
|
45
|
+
const minutes = Math.floor(remaining / (SECONDS_PER_MINUTE * ISC_TIME_SECONDS_PRECISION));
|
|
46
|
+
remaining %= SECONDS_PER_MINUTE * ISC_TIME_SECONDS_PRECISION;
|
|
32
47
|
return {
|
|
33
48
|
hours,
|
|
34
49
|
minutes,
|
|
@@ -36,11 +51,15 @@ function decodeFirebirdTime(ticks) {
|
|
|
36
51
|
fractions: remaining % ISC_TIME_SECONDS_PRECISION
|
|
37
52
|
};
|
|
38
53
|
}
|
|
54
|
+
const CLOCK_DIGIT_WIDTH = 2;
|
|
55
|
+
const YEAR_DIGIT_WIDTH = 4;
|
|
56
|
+
const MILLIS_DIGIT_WIDTH = 3;
|
|
57
|
+
const TICKS_PER_MILLISECOND = 10;
|
|
39
58
|
function pad2(value) {
|
|
40
|
-
return String(value).padStart(
|
|
59
|
+
return String(value).padStart(CLOCK_DIGIT_WIDTH, "0");
|
|
41
60
|
}
|
|
42
61
|
function pad4(value) {
|
|
43
|
-
return String(value).padStart(
|
|
62
|
+
return String(value).padStart(YEAR_DIGIT_WIDTH, "0");
|
|
44
63
|
}
|
|
45
64
|
function formatFirebirdDate(days) {
|
|
46
65
|
const { year, month, day } = decodeFirebirdDate(days);
|
|
@@ -48,8 +67,8 @@ function formatFirebirdDate(days) {
|
|
|
48
67
|
}
|
|
49
68
|
function formatFirebirdTime(ticks) {
|
|
50
69
|
const { hours, minutes, seconds, fractions } = decodeFirebirdTime(ticks);
|
|
51
|
-
const millis = Math.round(fractions /
|
|
52
|
-
return `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}.${String(millis).padStart(
|
|
70
|
+
const millis = Math.round(fractions / TICKS_PER_MILLISECOND);
|
|
71
|
+
return `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}.${String(millis).padStart(MILLIS_DIGIT_WIDTH, "0")}`;
|
|
53
72
|
}
|
|
54
73
|
function formatFirebirdTimestamp(days, ticks) {
|
|
55
74
|
return `${formatFirebirdDate(days)} ${formatFirebirdTime(ticks)}`;
|
package/dist/firebird/reader.cjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/firebird/reader.ts
|
|
3
|
+
const INT32_BYTE_LENGTH = 4;
|
|
4
|
+
const BYTE_1_SHIFT = 8;
|
|
5
|
+
const BYTE_2_SHIFT = 16;
|
|
6
|
+
const BYTE_3_SHIFT = 24;
|
|
7
|
+
const SIGNED_BYTE_SIGN_BIT = 128;
|
|
8
|
+
const SIGNED_BYTE_WRAP = 256;
|
|
3
9
|
var FirebirdBackupParseError = class extends Error {
|
|
4
10
|
offset;
|
|
5
11
|
constructor(message, offset) {
|
|
@@ -47,8 +53,8 @@ var FirebirdBackupReader = class {
|
|
|
47
53
|
}
|
|
48
54
|
readInt32Attribute() {
|
|
49
55
|
const bytes = this.readAttributeBytes();
|
|
50
|
-
if (bytes.length !==
|
|
51
|
-
return (bytes[0] ?? 0) | (bytes[1] ?? 0) <<
|
|
56
|
+
if (bytes.length !== INT32_BYTE_LENGTH) throw new FirebirdBackupParseError(`expected a 4-byte int32 attribute, found ${bytes.length} byte(s)`, this.position);
|
|
57
|
+
return (bytes[0] ?? 0) | (bytes[1] ?? 0) << BYTE_1_SHIFT | (bytes[2] ?? 0) << BYTE_2_SHIFT | (bytes[3] ?? 0) << BYTE_3_SHIFT;
|
|
52
58
|
}
|
|
53
59
|
readTextAttribute() {
|
|
54
60
|
const bytes = this.readAttributeBytes();
|
|
@@ -67,13 +73,13 @@ var FirebirdBackupReader = class {
|
|
|
67
73
|
return this.readRawBytes(length);
|
|
68
74
|
}
|
|
69
75
|
readBlobSegmentLength() {
|
|
70
|
-
return this.readLengthByte() | this.readLengthByte() <<
|
|
76
|
+
return this.readLengthByte() | this.readLengthByte() << BYTE_1_SHIFT;
|
|
71
77
|
}
|
|
72
78
|
readSignedByte() {
|
|
73
79
|
const byte = this.bytes[this.position];
|
|
74
80
|
if (byte === void 0) throw new FirebirdBackupParseError("unexpected end of stream reading a compression control byte", this.position);
|
|
75
81
|
this.position++;
|
|
76
|
-
return byte >=
|
|
82
|
+
return byte >= SIGNED_BYTE_SIGN_BIT ? byte - SIGNED_BYTE_WRAP : byte;
|
|
77
83
|
}
|
|
78
84
|
readCompressedPayload(decompressedLength) {
|
|
79
85
|
const output = new Uint8Array(decompressedLength);
|
|
@@ -96,6 +102,11 @@ var FirebirdBackupReader = class {
|
|
|
96
102
|
return output;
|
|
97
103
|
}
|
|
98
104
|
};
|
|
105
|
+
const THIRD_BYTE_OFFSET = 3;
|
|
106
|
+
const INT16_SIGN_EXTEND_SHIFT = 16;
|
|
107
|
+
const INT32_BITS_BIGINT = 32n;
|
|
108
|
+
const UINT32_MASK_BIGINT = 4294967295n;
|
|
109
|
+
const DOUBLE_BYTE_LENGTH = 8;
|
|
99
110
|
var XdrReader = class {
|
|
100
111
|
bytes;
|
|
101
112
|
position;
|
|
@@ -112,41 +123,41 @@ var XdrReader = class {
|
|
|
112
123
|
return this.position >= this.end;
|
|
113
124
|
}
|
|
114
125
|
readInt32() {
|
|
115
|
-
if (this.position +
|
|
126
|
+
if (this.position + INT32_BYTE_LENGTH > this.end) throw new FirebirdBackupParseError("unexpected end of XDR data reading a 4-byte integer", this.position);
|
|
116
127
|
const b0 = this.bytes[this.position] ?? 0;
|
|
117
128
|
const b1 = this.bytes[this.position + 1] ?? 0;
|
|
118
129
|
const b2 = this.bytes[this.position + 2] ?? 0;
|
|
119
|
-
const b3 = this.bytes[this.position +
|
|
120
|
-
this.position +=
|
|
121
|
-
return b0 <<
|
|
130
|
+
const b3 = this.bytes[this.position + THIRD_BYTE_OFFSET] ?? 0;
|
|
131
|
+
this.position += INT32_BYTE_LENGTH;
|
|
132
|
+
return b0 << BYTE_3_SHIFT | b1 << BYTE_2_SHIFT | b2 << BYTE_1_SHIFT | b3 | 0;
|
|
122
133
|
}
|
|
123
134
|
readInt16() {
|
|
124
|
-
return this.readInt32() <<
|
|
135
|
+
return this.readInt32() << INT16_SIGN_EXTEND_SHIFT >> INT16_SIGN_EXTEND_SHIFT;
|
|
125
136
|
}
|
|
126
137
|
readInt64() {
|
|
127
138
|
const high = this.readInt32();
|
|
128
139
|
const low = this.readInt32();
|
|
129
|
-
return BigInt(high) <<
|
|
140
|
+
return BigInt(high) << INT32_BITS_BIGINT | BigInt(low) & UINT32_MASK_BIGINT;
|
|
130
141
|
}
|
|
131
142
|
readDouble() {
|
|
132
|
-
if (this.position +
|
|
133
|
-
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(
|
|
134
|
-
for (let i = 0; i <
|
|
135
|
-
this.position +=
|
|
143
|
+
if (this.position + DOUBLE_BYTE_LENGTH > this.end) throw new FirebirdBackupParseError("unexpected end of XDR data reading an 8-byte double", this.position);
|
|
144
|
+
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(DOUBLE_BYTE_LENGTH));
|
|
145
|
+
for (let i = 0; i < DOUBLE_BYTE_LENGTH; i++) view.setUint8(i, this.bytes[this.position + i] ?? 0);
|
|
146
|
+
this.position += DOUBLE_BYTE_LENGTH;
|
|
136
147
|
return view.getFloat64(0, false);
|
|
137
148
|
}
|
|
138
149
|
readFloat() {
|
|
139
|
-
if (this.position +
|
|
140
|
-
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(
|
|
141
|
-
for (let i = 0; i <
|
|
142
|
-
this.position +=
|
|
150
|
+
if (this.position + INT32_BYTE_LENGTH > this.end) throw new FirebirdBackupParseError("unexpected end of XDR data reading a 4-byte float", this.position);
|
|
151
|
+
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(INT32_BYTE_LENGTH));
|
|
152
|
+
for (let i = 0; i < INT32_BYTE_LENGTH; i++) view.setUint8(i, this.bytes[this.position + i] ?? 0);
|
|
153
|
+
this.position += INT32_BYTE_LENGTH;
|
|
143
154
|
return view.getFloat32(0, false);
|
|
144
155
|
}
|
|
145
156
|
readOpaque(len) {
|
|
146
157
|
if (this.position + len > this.end) throw new FirebirdBackupParseError(`unexpected end of XDR data reading ${len} opaque byte(s)`, this.position);
|
|
147
158
|
const slice = this.bytes.subarray(this.position, this.position + len);
|
|
148
159
|
this.position += len;
|
|
149
|
-
const padding = (
|
|
160
|
+
const padding = (INT32_BYTE_LENGTH - len % INT32_BYTE_LENGTH) % INT32_BYTE_LENGTH;
|
|
150
161
|
this.position += padding;
|
|
151
162
|
return slice;
|
|
152
163
|
}
|