@justybase/spreadsheet-tasks 1.2.0 → 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.
@@ -0,0 +1,74 @@
1
+ import { XlsbReader } from '../src/XlsbReader';
2
+ import { XlsxReader } from '../src/XlsxReader';
3
+ import * as fs from 'fs';
4
+ import * as path from 'path';
5
+
6
+ const OUTPUT_DIR = './test-output';
7
+
8
+ async function verifyFile(filePath: string, label: string) {
9
+ console.log(`\n--- Verifying: ${label} ---`);
10
+ const ext = path.extname(filePath).toLowerCase();
11
+
12
+ let reader: XlsbReader | XlsxReader;
13
+ if (ext === '.xlsb') {
14
+ reader = new XlsbReader();
15
+ } else {
16
+ reader = new XlsxReader();
17
+ }
18
+
19
+ await reader.open(filePath);
20
+
21
+ const sheetNames = reader.getSheetNames();
22
+ console.log(` Sheets: ${sheetNames.join(', ')}`);
23
+ console.log(` Rows: ${reader.rowCount}, Cols: ${reader.fieldCount}`);
24
+
25
+ const allRows: any[][] = [];
26
+ const isAsync = ext !== '.xlsb';
27
+ while (isAsync ? await (reader as XlsxReader).read() : (reader as XlsbReader).read()) {
28
+ const row: any[] = [];
29
+ for (let i = 0; i < reader.fieldCount; i++) {
30
+ row.push(reader.getValue(i));
31
+ }
32
+ allRows.push(row);
33
+ }
34
+
35
+ const printCount = Math.min(allRows.length, 15);
36
+ for (let r = 0; r < printCount; r++) {
37
+ const row = allRows[r];
38
+ const vals = row.map((v: any) => {
39
+ if (v === null || v === undefined) return '';
40
+ if (v instanceof Date) return v.toISOString();
41
+ if (typeof v === 'number') return v.toString();
42
+ return String(v).substring(0, 40);
43
+ });
44
+ console.log(` [${vals.join(', ')}]`);
45
+ }
46
+ if (allRows.length > printCount) {
47
+ console.log(` ... (${allRows.length - printCount} more rows)`);
48
+ }
49
+
50
+ reader.close();
51
+ console.log(` ✅ ${label} - ${allRows.length} rows read`);
52
+ }
53
+
54
+ async function main() {
55
+ const files = [
56
+ { file: `${OUTPUT_DIR}/formats_demo_xlsb.xlsb`, label: 'XLSB Format Demo' },
57
+ { file: `${OUTPUT_DIR}/formats_demo_xlsx.xlsx`, label: 'XLSX Format Demo' },
58
+ { file: `${OUTPUT_DIR}/formats_streaming_demo.xlsb`, label: 'XLSB Streaming Demo' },
59
+ { file: `${OUTPUT_DIR}/sales_report_demo.xlsx`, label: 'Sales Report Demo' },
60
+ { file: `${OUTPUT_DIR}/comprehensive_formats_demo.xlsb`, label: 'Comprehensive Demo' },
61
+ ];
62
+
63
+ for (const f of files) {
64
+ if (fs.existsSync(f.file)) {
65
+ await verifyFile(f.file, f.label);
66
+ } else {
67
+ console.log(`\n--- Skipping: ${f.label} (file not found) ---`);
68
+ }
69
+ }
70
+
71
+ console.log('\n✅ All verifications complete!');
72
+ }
73
+
74
+ main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justybase/spreadsheet-tasks",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "High-performance TypeScript library for reading and writing Excel files in XLSB and XLSX formats. XLSB is 3.3x faster to write and 2.1x faster to read than XLSX.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -62,9 +62,9 @@
62
62
  "@types/node": "^22.10.5",
63
63
  "@types/yauzl": "^2.10.3",
64
64
  "eslint": "^9.17.0",
65
- "exceljs": "^4.4.0",
65
+ "exceljs": "^3.4.0",
66
66
  "ts-node": "^10.9.2",
67
67
  "typescript": "^5.7.2",
68
68
  "typescript-eslint": "^8.19.1"
69
69
  }
70
- }
70
+ }