@js-ak/excel-toolbox 1.2.6 → 1.3.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 +2 -2
- package/build/cjs/lib/index.js +1 -0
- package/build/cjs/lib/template/index.js +17 -0
- package/build/cjs/lib/template/template-fs.js +465 -0
- package/build/cjs/lib/template/utils/check-row.js +23 -0
- package/build/cjs/lib/template/utils/check-rows.js +19 -0
- package/build/cjs/lib/template/utils/check-start-row.js +18 -0
- package/build/cjs/lib/template/utils/column-index-to-letter.js +17 -0
- package/build/cjs/lib/template/utils/escape-xml.js +24 -0
- package/build/cjs/lib/template/utils/get-max-row-number.js +20 -0
- package/build/cjs/lib/template/utils/get-rows-above.js +23 -0
- package/build/cjs/lib/template/utils/get-rows-below.js +23 -0
- package/build/cjs/lib/template/utils/index.js +27 -0
- package/build/cjs/lib/template/utils/parse-rows.js +30 -0
- package/build/cjs/lib/template/utils/to-excel-column-object.js +29 -0
- package/build/cjs/lib/template/utils/write-rows-to-stream.js +41 -0
- package/build/cjs/lib/xml/build-merged-sheet.js +1 -1
- package/build/cjs/lib/zip/constants.js +16 -1
- package/build/cjs/lib/zip/create-sync.js +32 -32
- package/build/cjs/lib/zip/create-with-stream.js +150 -0
- package/build/cjs/lib/zip/create.js +32 -32
- package/build/cjs/lib/zip/index.js +1 -0
- package/build/cjs/lib/zip/read-sync.js +60 -12
- package/build/cjs/lib/zip/read.js +60 -12
- package/build/cjs/lib/zip/utils/crc-32-stream.js +36 -0
- package/build/cjs/lib/zip/utils/crc-32.js +43 -0
- package/build/cjs/lib/zip/utils/dos-time.js +50 -0
- package/build/cjs/lib/zip/utils/find-data-descriptor.js +29 -0
- package/build/cjs/lib/zip/utils/index.js +21 -0
- package/build/cjs/lib/zip/utils/to-bytes.js +37 -0
- package/build/esm/lib/index.js +1 -0
- package/build/esm/lib/template/index.js +1 -0
- package/build/esm/lib/template/template-fs.js +428 -0
- package/build/esm/lib/template/utils/check-row.js +20 -0
- package/build/esm/lib/template/utils/check-rows.js +16 -0
- package/build/esm/lib/template/utils/check-start-row.js +15 -0
- package/build/esm/lib/template/utils/column-index-to-letter.js +14 -0
- package/build/esm/lib/template/utils/escape-xml.js +21 -0
- package/build/esm/lib/template/utils/get-max-row-number.js +17 -0
- package/build/esm/lib/template/utils/get-rows-above.js +20 -0
- package/build/esm/lib/template/utils/get-rows-below.js +20 -0
- package/build/esm/lib/template/utils/index.js +11 -0
- package/build/esm/lib/template/utils/parse-rows.js +27 -0
- package/build/esm/lib/template/utils/to-excel-column-object.js +26 -0
- package/build/esm/lib/template/utils/write-rows-to-stream.js +38 -0
- package/build/esm/lib/xml/build-merged-sheet.js +1 -1
- package/build/esm/lib/zip/constants.js +15 -0
- package/build/esm/lib/zip/create-sync.js +1 -1
- package/build/esm/lib/zip/create-with-stream.js +111 -0
- package/build/esm/lib/zip/create.js +1 -1
- package/build/esm/lib/zip/index.js +1 -0
- package/build/esm/lib/zip/read-sync.js +27 -12
- package/build/esm/lib/zip/read.js +27 -12
- package/build/esm/lib/zip/utils/crc-32-stream.js +33 -0
- package/build/esm/lib/zip/utils/crc-32.js +40 -0
- package/build/esm/lib/zip/utils/dos-time.js +47 -0
- package/build/esm/lib/zip/utils/find-data-descriptor.js +26 -0
- package/build/esm/lib/zip/utils/index.js +5 -0
- package/build/esm/lib/zip/utils/to-bytes.js +34 -0
- package/build/types/lib/index.d.ts +1 -0
- package/build/types/lib/template/index.d.ts +1 -0
- package/build/types/lib/template/template-fs.d.ts +122 -0
- package/build/types/lib/template/utils/check-row.d.ts +14 -0
- package/build/types/lib/template/utils/check-rows.d.ts +11 -0
- package/build/types/lib/template/utils/check-start-row.d.ts +8 -0
- package/build/types/lib/template/utils/column-index-to-letter.d.ts +7 -0
- package/build/types/lib/template/utils/escape-xml.d.ts +14 -0
- package/build/types/lib/template/utils/get-max-row-number.d.ts +7 -0
- package/build/types/lib/template/utils/get-rows-above.d.ts +12 -0
- package/build/types/lib/template/utils/get-rows-below.d.ts +12 -0
- package/build/types/lib/template/utils/index.d.ts +11 -0
- package/build/types/lib/template/utils/parse-rows.d.ts +1 -0
- package/build/types/lib/template/utils/to-excel-column-object.d.ts +10 -0
- package/build/types/lib/template/utils/write-rows-to-stream.d.ts +25 -0
- package/build/types/lib/zip/constants.d.ts +9 -0
- package/build/types/lib/zip/create-with-stream.d.ts +13 -0
- package/build/types/lib/zip/index.d.ts +1 -0
- package/build/types/lib/zip/utils/crc-32-stream.d.ts +11 -0
- package/build/types/lib/zip/utils/crc-32.d.ts +15 -0
- package/build/types/lib/zip/utils/dos-time.d.ts +25 -0
- package/build/types/lib/zip/utils/find-data-descriptor.d.ts +15 -0
- package/build/types/lib/zip/utils/index.d.ts +5 -0
- package/build/types/lib/zip/utils/to-bytes.d.ts +20 -0
- package/package.json +1 -1
- package/build/cjs/lib/zip/utils.js +0 -157
- package/build/esm/lib/zip/utils.js +0 -152
- package/build/types/lib/zip/utils.d.ts +0 -58
@@ -1,58 +0,0 @@
|
|
1
|
-
import { Buffer } from "node:buffer";
|
2
|
-
/**
|
3
|
-
* Computes a CRC-32 checksum for the given Buffer using the standard IEEE 802.3 polynomial.
|
4
|
-
* This implementation uses a precomputed lookup table for optimal performance.
|
5
|
-
*
|
6
|
-
* The algorithm follows these characteristics:
|
7
|
-
* - Polynomial: 0xEDB88320 (reversed representation of 0x04C11DB7)
|
8
|
-
* - Initial value: 0xFFFFFFFF (inverted by ~0)
|
9
|
-
* - Final XOR value: 0xFFFFFFFF (achieved by inverting the result)
|
10
|
-
* - Input and output reflection: Yes
|
11
|
-
*
|
12
|
-
* @param {Buffer} buf - The input buffer to calculate checksum for
|
13
|
-
* @returns {number} - The 32-bit unsigned CRC-32 checksum (0x00000000 to 0xFFFFFFFF)
|
14
|
-
*/
|
15
|
-
export declare function crc32(buf: Buffer): number;
|
16
|
-
/**
|
17
|
-
* Converts a JavaScript Date object to a 4-byte Buffer in MS-DOS date/time format
|
18
|
-
* as specified in the ZIP file format specification (PKZIP APPNOTE.TXT).
|
19
|
-
*
|
20
|
-
* The MS-DOS date/time format packs both date and time into 4 bytes (32 bits) with
|
21
|
-
* the following bit layout:
|
22
|
-
*
|
23
|
-
* Time portion (2 bytes/16 bits):
|
24
|
-
* - Bits 00-04: Seconds divided by 2 (0-29, representing 0-58 seconds)
|
25
|
-
* - Bits 05-10: Minutes (0-59)
|
26
|
-
* - Bits 11-15: Hours (0-23)
|
27
|
-
*
|
28
|
-
* Date portion (2 bytes/16 bits):
|
29
|
-
* - Bits 00-04: Day (1-31)
|
30
|
-
* - Bits 05-08: Month (1-12)
|
31
|
-
* - Bits 09-15: Year offset from 1980 (0-127, representing 1980-2107)
|
32
|
-
*
|
33
|
-
* @param {Date} date - The JavaScript Date object to convert
|
34
|
-
* @returns {Buffer} - 4-byte Buffer containing:
|
35
|
-
* - Bytes 0-1: DOS time (hours, minutes, seconds/2)
|
36
|
-
* - Bytes 2-3: DOS date (year-1980, month, day)
|
37
|
-
* @throws {RangeError} - If the date is before 1980 or after 2107
|
38
|
-
*/
|
39
|
-
export declare function dosTime(date: Date): Buffer;
|
40
|
-
/**
|
41
|
-
* Converts a numeric value into a fixed-length Buffer representation,
|
42
|
-
* storing the value in little-endian format with right-padding of zeros.
|
43
|
-
*
|
44
|
-
* This is particularly useful for binary protocols or file formats that
|
45
|
-
* require fixed-width numeric fields.
|
46
|
-
*
|
47
|
-
* @param {number} value - The numeric value to convert to bytes.
|
48
|
-
* Note: JavaScript numbers are IEEE 754 doubles, but only the
|
49
|
-
* integer portion will be used (up to 53-bit precision).
|
50
|
-
* @param {number} len - The desired length of the output Buffer in bytes.
|
51
|
-
* Must be a positive integer.
|
52
|
-
* @returns {Buffer} - A new Buffer of exactly `len` bytes containing:
|
53
|
-
* 1. The value's bytes in little-endian order (least significant byte first)
|
54
|
-
* 2. Zero padding in any remaining higher-order bytes
|
55
|
-
* @throws {RangeError} - If the value requires more bytes than `len` to represent
|
56
|
-
* (though this is currently not explicitly checked)
|
57
|
-
*/
|
58
|
-
export declare function toBytes(value: number, len: number): Buffer;
|