@nazarkalytiuk/rusc-xlsx 1.0.3 → 1.0.5
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 +27 -10
- package/index.d.ts +1 -1
- package/index.js +105 -105
- package/package.json +8 -8
- package/wrapper.d.ts +20 -0
- package/wrapper.js +19 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# rusc-xlsx
|
|
2
2
|
|
|
3
3
|
[](https://github.com/NazarKalytiuk/napi_rust_xlsxwrighter/actions/workflows/test.yml)
|
|
4
|
-
[](https://www.npmjs.com/package/rusc-xlsx)
|
|
4
|
+
[]([https://www.npmjs.com/package/rusc-xlsx](https://www.npmjs.com/package/@nazarkalytiuk/rusc-xlsx))
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
7
|
Fast, feature-complete Excel XLSX library for Node.js powered by [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) and NAPI-RS.
|
|
@@ -62,7 +62,7 @@ Fast, feature-complete Excel XLSX library for Node.js powered by [rust_xlsxwrite
|
|
|
62
62
|
## Installation
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
npm install rusc-xlsx
|
|
65
|
+
npm install @nazarkalytiuk/rusc-xlsx
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
### Requirements
|
|
@@ -73,7 +73,7 @@ npm install rusc-xlsx
|
|
|
73
73
|
## Quick Start
|
|
74
74
|
|
|
75
75
|
```javascript
|
|
76
|
-
const { Workbook, Format } = require('rusc-xlsx');
|
|
76
|
+
const { Workbook, Format } = require('@nazarkalytiuk/rusc-xlsx');
|
|
77
77
|
|
|
78
78
|
// Create workbook and worksheet
|
|
79
79
|
const workbook = new Workbook();
|
|
@@ -116,6 +116,8 @@ const worksheet = workbook.addWorksheetWithConstantMemory('Large');
|
|
|
116
116
|
- **Memory**: Constant ~0.02 MB (regardless of size!)
|
|
117
117
|
- **Limitations**: Sequential row writing only, no tables
|
|
118
118
|
|
|
119
|
+
> **Important:** For large exports, use `addWorksheetWithConstantMemory()` with `save(filename)` — not `saveToBuffer()`. The constant memory mode flushes rows to temp files as they're written, but `saveToBuffer()` would load the entire result back into memory, defeating the purpose. Use `saveToStream()` if you need to pipe the output without disk I/O overhead.
|
|
120
|
+
|
|
119
121
|
**Example: 1 million rows**
|
|
120
122
|
```javascript
|
|
121
123
|
const workbook = new Workbook();
|
|
@@ -126,7 +128,7 @@ for (let row = 0; row < 1000000; row++) {
|
|
|
126
128
|
worksheet.write(row, 1, row * 100);
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
workbook.save('large.xlsx');
|
|
131
|
+
workbook.save('large.xlsx'); // Use save(), not saveToBuffer()
|
|
130
132
|
```
|
|
131
133
|
|
|
132
134
|
### Low Memory Mode
|
|
@@ -144,7 +146,7 @@ const worksheet = workbook.addWorksheetWithLowMemory('Sales');
|
|
|
144
146
|
Full TypeScript definitions included:
|
|
145
147
|
|
|
146
148
|
```typescript
|
|
147
|
-
import { Workbook, Format } from 'rusc-xlsx';
|
|
149
|
+
import { Workbook, Format } from '@nazarkalytiuk/rusc-xlsx';
|
|
148
150
|
|
|
149
151
|
const workbook = new Workbook();
|
|
150
152
|
const worksheet = workbook.addWorksheet('Data');
|
|
@@ -213,11 +215,26 @@ workbook.save('output.xlsx');
|
|
|
213
215
|
|
|
214
216
|
See the `examples/` directory for complete examples:
|
|
215
217
|
- `basic.js` - Simple workbook creation
|
|
216
|
-
- `formatting.js` - Cell formatting
|
|
217
|
-
- `
|
|
218
|
-
- `
|
|
219
|
-
- `
|
|
220
|
-
- `
|
|
218
|
+
- `formatting.js` - Cell formatting and number formats
|
|
219
|
+
- `data-types.js` - All supported data types
|
|
220
|
+
- `datetime.js` - Date/time writing methods and formats
|
|
221
|
+
- `multiple-sheets.js` - Working with multiple worksheets
|
|
222
|
+
- `advanced-styling.js` - Fonts, borders, patterns, fills
|
|
223
|
+
- `advanced-features.js` - Formulas, data validation, hyperlinks, freeze panes
|
|
224
|
+
- `charts.js` - Column, line, pie, bar, and scatter charts
|
|
225
|
+
- `tables.js` - Excel tables with totals, formulas, and styles
|
|
226
|
+
- `images.js` - Inserting images from buffers with scaling and links
|
|
227
|
+
- `sparklines.js` - Line, column, and win/lose sparklines
|
|
228
|
+
- `rich-text.js` - Multi-format text within cells
|
|
229
|
+
- `notes.js` - Cell comments with custom styling
|
|
230
|
+
- `conditional-formatting-and-page-setup.js` - Conditional formatting and print setup
|
|
231
|
+
- `protection.js` - Worksheet protection with granular permissions
|
|
232
|
+
- `doc-properties.js` - Document metadata (author, title, etc.)
|
|
233
|
+
- `constant-memory.js` - Large datasets with constant memory mode
|
|
234
|
+
- `low-memory.js` - Large datasets with low memory mode
|
|
235
|
+
- `save-to-buffer.js` - Saving to Buffer for HTTP responses
|
|
236
|
+
- `typescript-example.ts` - Full TypeScript usage
|
|
237
|
+
- `type-safety-demo.ts` - TypeScript type safety features
|
|
221
238
|
|
|
222
239
|
## Building from Source
|
|
223
240
|
|
package/index.d.ts
CHANGED
|
@@ -380,7 +380,7 @@ export declare class RuscTableColumn {
|
|
|
380
380
|
/** Set the header name for the column */
|
|
381
381
|
setHeader(header: string): this
|
|
382
382
|
/** Set the total function for the column */
|
|
383
|
-
setTotalFunction(
|
|
383
|
+
setTotalFunction(func: string): this
|
|
384
384
|
/** Set a custom total label for the column */
|
|
385
385
|
setTotalLabel(label: string): this
|
|
386
386
|
/** Set a custom formula for the column */
|
package/index.js
CHANGED
|
@@ -75,10 +75,10 @@ function requireNative() {
|
|
|
75
75
|
loadErrors.push(e)
|
|
76
76
|
}
|
|
77
77
|
try {
|
|
78
|
-
const binding = require('rusc-xlsx-android-arm64')
|
|
79
|
-
const bindingPackageVersion = require('rusc-xlsx-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
78
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-android-arm64')
|
|
79
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-android-arm64/package.json').version
|
|
80
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -91,10 +91,10 @@ function requireNative() {
|
|
|
91
91
|
loadErrors.push(e)
|
|
92
92
|
}
|
|
93
93
|
try {
|
|
94
|
-
const binding = require('rusc-xlsx-android-arm-eabi')
|
|
95
|
-
const bindingPackageVersion = require('rusc-xlsx-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
94
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-android-arm-eabi')
|
|
95
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-android-arm-eabi/package.json').version
|
|
96
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -112,10 +112,10 @@ function requireNative() {
|
|
|
112
112
|
loadErrors.push(e)
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
|
-
const binding = require('rusc-xlsx-win32-x64-gnu')
|
|
116
|
-
const bindingPackageVersion = require('rusc-xlsx-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
115
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-win32-x64-gnu')
|
|
116
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-x64-gnu/package.json').version
|
|
117
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -128,10 +128,10 @@ function requireNative() {
|
|
|
128
128
|
loadErrors.push(e)
|
|
129
129
|
}
|
|
130
130
|
try {
|
|
131
|
-
const binding = require('rusc-xlsx-win32-x64-msvc')
|
|
132
|
-
const bindingPackageVersion = require('rusc-xlsx-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
131
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-win32-x64-msvc')
|
|
132
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-x64-msvc/package.json').version
|
|
133
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -145,10 +145,10 @@ function requireNative() {
|
|
|
145
145
|
loadErrors.push(e)
|
|
146
146
|
}
|
|
147
147
|
try {
|
|
148
|
-
const binding = require('rusc-xlsx-win32-ia32-msvc')
|
|
149
|
-
const bindingPackageVersion = require('rusc-xlsx-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
148
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc')
|
|
149
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc/package.json').version
|
|
150
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -161,10 +161,10 @@ function requireNative() {
|
|
|
161
161
|
loadErrors.push(e)
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
|
-
const binding = require('rusc-xlsx-win32-arm64-msvc')
|
|
165
|
-
const bindingPackageVersion = require('rusc-xlsx-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
164
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc')
|
|
165
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc/package.json').version
|
|
166
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -180,10 +180,10 @@ function requireNative() {
|
|
|
180
180
|
loadErrors.push(e)
|
|
181
181
|
}
|
|
182
182
|
try {
|
|
183
|
-
const binding = require('rusc-xlsx-darwin-universal')
|
|
184
|
-
const bindingPackageVersion = require('rusc-xlsx-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
183
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-universal')
|
|
184
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-universal/package.json').version
|
|
185
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -196,10 +196,10 @@ function requireNative() {
|
|
|
196
196
|
loadErrors.push(e)
|
|
197
197
|
}
|
|
198
198
|
try {
|
|
199
|
-
const binding = require('rusc-xlsx-darwin-x64')
|
|
200
|
-
const bindingPackageVersion = require('rusc-xlsx-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
199
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-x64')
|
|
200
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-x64/package.json').version
|
|
201
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -212,10 +212,10 @@ function requireNative() {
|
|
|
212
212
|
loadErrors.push(e)
|
|
213
213
|
}
|
|
214
214
|
try {
|
|
215
|
-
const binding = require('rusc-xlsx-darwin-arm64')
|
|
216
|
-
const bindingPackageVersion = require('rusc-xlsx-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
215
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-arm64')
|
|
216
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-arm64/package.json').version
|
|
217
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -232,10 +232,10 @@ function requireNative() {
|
|
|
232
232
|
loadErrors.push(e)
|
|
233
233
|
}
|
|
234
234
|
try {
|
|
235
|
-
const binding = require('rusc-xlsx-freebsd-x64')
|
|
236
|
-
const bindingPackageVersion = require('rusc-xlsx-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
235
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-freebsd-x64')
|
|
236
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-freebsd-x64/package.json').version
|
|
237
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -248,10 +248,10 @@ function requireNative() {
|
|
|
248
248
|
loadErrors.push(e)
|
|
249
249
|
}
|
|
250
250
|
try {
|
|
251
|
-
const binding = require('rusc-xlsx-freebsd-arm64')
|
|
252
|
-
const bindingPackageVersion = require('rusc-xlsx-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
251
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-freebsd-arm64')
|
|
252
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-freebsd-arm64/package.json').version
|
|
253
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -269,10 +269,10 @@ function requireNative() {
|
|
|
269
269
|
loadErrors.push(e)
|
|
270
270
|
}
|
|
271
271
|
try {
|
|
272
|
-
const binding = require('rusc-xlsx-linux-x64-musl')
|
|
273
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
272
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-x64-musl')
|
|
273
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-x64-musl/package.json').version
|
|
274
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -285,10 +285,10 @@ function requireNative() {
|
|
|
285
285
|
loadErrors.push(e)
|
|
286
286
|
}
|
|
287
287
|
try {
|
|
288
|
-
const binding = require('rusc-xlsx-linux-x64-gnu')
|
|
289
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
288
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-x64-gnu')
|
|
289
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-x64-gnu/package.json').version
|
|
290
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -303,10 +303,10 @@ function requireNative() {
|
|
|
303
303
|
loadErrors.push(e)
|
|
304
304
|
}
|
|
305
305
|
try {
|
|
306
|
-
const binding = require('rusc-xlsx-linux-arm64-musl')
|
|
307
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
306
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-musl')
|
|
307
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-musl/package.json').version
|
|
308
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -319,10 +319,10 @@ function requireNative() {
|
|
|
319
319
|
loadErrors.push(e)
|
|
320
320
|
}
|
|
321
321
|
try {
|
|
322
|
-
const binding = require('rusc-xlsx-linux-arm64-gnu')
|
|
323
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
322
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu')
|
|
323
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu/package.json').version
|
|
324
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -337,10 +337,10 @@ function requireNative() {
|
|
|
337
337
|
loadErrors.push(e)
|
|
338
338
|
}
|
|
339
339
|
try {
|
|
340
|
-
const binding = require('rusc-xlsx-linux-arm-musleabihf')
|
|
341
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
340
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm-musleabihf')
|
|
341
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm-musleabihf/package.json').version
|
|
342
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -353,10 +353,10 @@ function requireNative() {
|
|
|
353
353
|
loadErrors.push(e)
|
|
354
354
|
}
|
|
355
355
|
try {
|
|
356
|
-
const binding = require('rusc-xlsx-linux-arm-gnueabihf')
|
|
357
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
356
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm-gnueabihf')
|
|
357
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm-gnueabihf/package.json').version
|
|
358
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -371,10 +371,10 @@ function requireNative() {
|
|
|
371
371
|
loadErrors.push(e)
|
|
372
372
|
}
|
|
373
373
|
try {
|
|
374
|
-
const binding = require('rusc-xlsx-linux-loong64-musl')
|
|
375
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
374
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-musl')
|
|
375
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-musl/package.json').version
|
|
376
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -387,10 +387,10 @@ function requireNative() {
|
|
|
387
387
|
loadErrors.push(e)
|
|
388
388
|
}
|
|
389
389
|
try {
|
|
390
|
-
const binding = require('rusc-xlsx-linux-loong64-gnu')
|
|
391
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
390
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-gnu')
|
|
391
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-gnu/package.json').version
|
|
392
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -405,10 +405,10 @@ function requireNative() {
|
|
|
405
405
|
loadErrors.push(e)
|
|
406
406
|
}
|
|
407
407
|
try {
|
|
408
|
-
const binding = require('rusc-xlsx-linux-riscv64-musl')
|
|
409
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
408
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-musl')
|
|
409
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-musl/package.json').version
|
|
410
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -421,10 +421,10 @@ function requireNative() {
|
|
|
421
421
|
loadErrors.push(e)
|
|
422
422
|
}
|
|
423
423
|
try {
|
|
424
|
-
const binding = require('rusc-xlsx-linux-riscv64-gnu')
|
|
425
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
424
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-gnu')
|
|
425
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-gnu/package.json').version
|
|
426
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -438,10 +438,10 @@ function requireNative() {
|
|
|
438
438
|
loadErrors.push(e)
|
|
439
439
|
}
|
|
440
440
|
try {
|
|
441
|
-
const binding = require('rusc-xlsx-linux-ppc64-gnu')
|
|
442
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
441
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-ppc64-gnu')
|
|
442
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-ppc64-gnu/package.json').version
|
|
443
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -454,10 +454,10 @@ function requireNative() {
|
|
|
454
454
|
loadErrors.push(e)
|
|
455
455
|
}
|
|
456
456
|
try {
|
|
457
|
-
const binding = require('rusc-xlsx-linux-s390x-gnu')
|
|
458
|
-
const bindingPackageVersion = require('rusc-xlsx-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
457
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-linux-s390x-gnu')
|
|
458
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-s390x-gnu/package.json').version
|
|
459
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -474,10 +474,10 @@ function requireNative() {
|
|
|
474
474
|
loadErrors.push(e)
|
|
475
475
|
}
|
|
476
476
|
try {
|
|
477
|
-
const binding = require('rusc-xlsx-openharmony-arm64')
|
|
478
|
-
const bindingPackageVersion = require('rusc-xlsx-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
477
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm64')
|
|
478
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm64/package.json').version
|
|
479
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -490,10 +490,10 @@ function requireNative() {
|
|
|
490
490
|
loadErrors.push(e)
|
|
491
491
|
}
|
|
492
492
|
try {
|
|
493
|
-
const binding = require('rusc-xlsx-openharmony-x64')
|
|
494
|
-
const bindingPackageVersion = require('rusc-xlsx-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
493
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-x64')
|
|
494
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-x64/package.json').version
|
|
495
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -506,10 +506,10 @@ function requireNative() {
|
|
|
506
506
|
loadErrors.push(e)
|
|
507
507
|
}
|
|
508
508
|
try {
|
|
509
|
-
const binding = require('rusc-xlsx-openharmony-arm')
|
|
510
|
-
const bindingPackageVersion = require('rusc-xlsx-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
509
|
+
const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm')
|
|
510
|
+
const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm/package.json').version
|
|
511
|
+
if (bindingPackageVersion !== '1.0.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -538,7 +538,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
538
538
|
}
|
|
539
539
|
if (!nativeBinding) {
|
|
540
540
|
try {
|
|
541
|
-
wasiBinding = require('rusc-xlsx-wasm32-wasi')
|
|
541
|
+
wasiBinding = require('@nazarkalytiuk/rusc-xlsx-wasm32-wasi')
|
|
542
542
|
nativeBinding = wasiBinding
|
|
543
543
|
} catch (err) {
|
|
544
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nazarkalytiuk/rusc-xlsx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Fast Excel XLSX library for Node.js powered by rust_xlsxwriter",
|
|
5
5
|
"main": "wrapper.js",
|
|
6
6
|
"types": "wrapper.d.ts",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"node": ">=16"
|
|
70
70
|
},
|
|
71
71
|
"optionalDependencies": {
|
|
72
|
-
"@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "1.0.
|
|
73
|
-
"@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "1.0.
|
|
74
|
-
"@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "1.0.
|
|
75
|
-
"@nazarkalytiuk/rusc-xlsx-darwin-universal": "1.0.
|
|
76
|
-
"@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "1.0.
|
|
77
|
-
"@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "1.0.
|
|
78
|
-
"@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "1.0.
|
|
72
|
+
"@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "1.0.5",
|
|
73
|
+
"@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "1.0.5",
|
|
74
|
+
"@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "1.0.5",
|
|
75
|
+
"@nazarkalytiuk/rusc-xlsx-darwin-universal": "1.0.5",
|
|
76
|
+
"@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "1.0.5",
|
|
77
|
+
"@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "1.0.5",
|
|
78
|
+
"@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "1.0.5"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/wrapper.d.ts
CHANGED
|
@@ -2242,6 +2242,26 @@ export declare class Workbook {
|
|
|
2242
2242
|
*/
|
|
2243
2243
|
saveToBuffer(): Buffer;
|
|
2244
2244
|
|
|
2245
|
+
/**
|
|
2246
|
+
* Save the workbook to a Writable stream
|
|
2247
|
+
*
|
|
2248
|
+
* Streams XLSX data directly to the writable without buffering the entire
|
|
2249
|
+
* file in memory. Combines the speed of `saveToBuffer()` with the low
|
|
2250
|
+
* memory footprint of `save(filename)`.
|
|
2251
|
+
*
|
|
2252
|
+
* @param writable - A Node.js Writable stream (e.g., fs.createWriteStream, HTTP response)
|
|
2253
|
+
* @example
|
|
2254
|
+
* const fs = require('fs');
|
|
2255
|
+
* const stream = fs.createWriteStream('output.xlsx');
|
|
2256
|
+
* workbook.saveToStream(stream);
|
|
2257
|
+
*
|
|
2258
|
+
* @example
|
|
2259
|
+
* // HTTP response
|
|
2260
|
+
* res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
2261
|
+
* workbook.saveToStream(res);
|
|
2262
|
+
*/
|
|
2263
|
+
saveToStream(writable: import('stream').Writable): void;
|
|
2264
|
+
|
|
2245
2265
|
/**
|
|
2246
2266
|
* Define a named range or formula
|
|
2247
2267
|
* @param name - Name for the range (e.g., 'Sales' or 'Sheet1!Sales' for local names)
|
package/wrapper.js
CHANGED
|
@@ -1263,6 +1263,25 @@ class Workbook {
|
|
|
1263
1263
|
return this._native.saveToBuffer()
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
+
saveToStream(writable) {
|
|
1267
|
+
const os = require('os')
|
|
1268
|
+
const path = require('path')
|
|
1269
|
+
const fs = require('fs')
|
|
1270
|
+
const crypto = require('crypto')
|
|
1271
|
+
|
|
1272
|
+
const tmpFile = path.join(os.tmpdir(), `rusc-xlsx-${crypto.randomBytes(8).toString('hex')}.xlsx`)
|
|
1273
|
+
this._native.save(tmpFile)
|
|
1274
|
+
|
|
1275
|
+
const readable = fs.createReadStream(tmpFile)
|
|
1276
|
+
readable.on('end', () => {
|
|
1277
|
+
fs.unlink(tmpFile, () => {})
|
|
1278
|
+
})
|
|
1279
|
+
readable.on('error', () => {
|
|
1280
|
+
fs.unlink(tmpFile, () => {})
|
|
1281
|
+
})
|
|
1282
|
+
readable.pipe(writable)
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1266
1285
|
defineName(name, formula) {
|
|
1267
1286
|
return this._native.defineName(name, formula)
|
|
1268
1287
|
}
|