xlsx-mini 0.0.0 → 0.0.1
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 +418 -2
- package/dist/browser.d.ts +16 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +36 -0
- package/dist/browser.js.map +1 -0
- package/dist/errors/index.d.ts +21 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +23 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/opc/index.d.ts +8 -0
- package/dist/opc/index.d.ts.map +1 -0
- package/dist/opc/index.js +8 -0
- package/dist/opc/index.js.map +1 -0
- package/dist/opc/lib/compression.d.ts +17 -0
- package/dist/opc/lib/compression.d.ts.map +1 -0
- package/dist/opc/lib/compression.js +54 -0
- package/dist/opc/lib/compression.js.map +1 -0
- package/dist/opc/lib/crc32.d.ts +8 -0
- package/dist/opc/lib/crc32.d.ts.map +1 -0
- package/dist/opc/lib/crc32.js +58 -0
- package/dist/opc/lib/crc32.js.map +1 -0
- package/dist/opc/lib/zip.d.ts +13 -0
- package/dist/opc/lib/zip.d.ts.map +1 -0
- package/dist/opc/lib/zip.js +104 -0
- package/dist/opc/lib/zip.js.map +1 -0
- package/dist/shared-strings/index.d.ts +9 -0
- package/dist/shared-strings/index.d.ts.map +1 -0
- package/dist/shared-strings/index.js +27 -0
- package/dist/shared-strings/index.js.map +1 -0
- package/dist/styles/index.d.ts +32 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +106 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/workbook/index.d.ts +27 -0
- package/dist/workbook/index.d.ts.map +1 -0
- package/dist/workbook/index.js +75 -0
- package/dist/workbook/index.js.map +1 -0
- package/dist/workbook/lib/model.d.ts +11 -0
- package/dist/workbook/lib/model.d.ts.map +1 -0
- package/dist/workbook/lib/model.js +2 -0
- package/dist/workbook/lib/model.js.map +1 -0
- package/dist/workbook/lib/validate.d.ts +4 -0
- package/dist/workbook/lib/validate.d.ts.map +1 -0
- package/dist/workbook/lib/validate.js +38 -0
- package/dist/workbook/lib/validate.js.map +1 -0
- package/dist/worksheet/index.d.ts +16 -0
- package/dist/worksheet/index.d.ts.map +1 -0
- package/dist/worksheet/index.js +25 -0
- package/dist/worksheet/index.js.map +1 -0
- package/dist/worksheet/lib/cell-ref.d.ts +6 -0
- package/dist/worksheet/lib/cell-ref.d.ts.map +1 -0
- package/dist/worksheet/lib/cell-ref.js +19 -0
- package/dist/worksheet/lib/cell-ref.js.map +1 -0
- package/dist/worksheet/lib/from-objects.d.ts +53 -0
- package/dist/worksheet/lib/from-objects.d.ts.map +1 -0
- package/dist/worksheet/lib/from-objects.js +65 -0
- package/dist/worksheet/lib/from-objects.js.map +1 -0
- package/dist/worksheet/lib/layout.d.ts +12 -0
- package/dist/worksheet/lib/layout.d.ts.map +1 -0
- package/dist/worksheet/lib/layout.js +58 -0
- package/dist/worksheet/lib/layout.js.map +1 -0
- package/dist/worksheet/lib/model.d.ts +112 -0
- package/dist/worksheet/lib/model.d.ts.map +1 -0
- package/dist/worksheet/lib/model.js +2 -0
- package/dist/worksheet/lib/model.js.map +1 -0
- package/dist/worksheet/lib/render-rows.d.ts +23 -0
- package/dist/worksheet/lib/render-rows.d.ts.map +1 -0
- package/dist/worksheet/lib/render-rows.js +167 -0
- package/dist/worksheet/lib/render-rows.js.map +1 -0
- package/dist/worksheet/lib/serial.d.ts +11 -0
- package/dist/worksheet/lib/serial.d.ts.map +1 -0
- package/dist/worksheet/lib/serial.js +44 -0
- package/dist/worksheet/lib/serial.js.map +1 -0
- package/dist/write-xlsx.d.ts +29 -0
- package/dist/write-xlsx.d.ts.map +1 -0
- package/dist/write-xlsx.js +49 -0
- package/dist/write-xlsx.js.map +1 -0
- package/dist/xml/index.d.ts +24 -0
- package/dist/xml/index.d.ts.map +1 -0
- package/dist/xml/index.js +152 -0
- package/dist/xml/index.js.map +1 -0
- package/package.json +79 -7
package/README.md
CHANGED
|
@@ -1,5 +1,421 @@
|
|
|
1
1
|
# xlsx-mini
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/xlsx-mini)
|
|
4
|
+
[](https://github.com/ANicholasson/xlsx-mini/actions/workflows/ci.yml)
|
|
5
|
+
[](./LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Writes `.xlsx` files from TypeScript with no dependencies, on every JavaScript runtime. You describe sheets, rows and cells; it returns the bytes. The files open without a repair dialog in Excel, Numbers, Google Sheets and LibreOffice, and the writer is measured on every change. Every TypeScript snippet in this README is run by the test suite.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add xlsx-mini
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
ESM only. Node 20.12 or later (22 or later for `require`), Bun, Deno, Cloudflare Workers, Vercel's edge runtime and evergreen browsers: the core uses only web-standard APIs, and the runtime matrix in CI proves each host on every change.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
<!-- snippet: quick-start -->
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { writeFile } from "node:fs/promises";
|
|
23
|
+
import { writeXlsx } from "xlsx-mini";
|
|
24
|
+
|
|
25
|
+
export default async function quickStart(path = "orders.xlsx"): Promise<void> {
|
|
26
|
+
const bytes = await writeXlsx({
|
|
27
|
+
sheets: [
|
|
28
|
+
{
|
|
29
|
+
name: "Orders",
|
|
30
|
+
rows: [
|
|
31
|
+
["Order", "Customer", "Total", "Paid"],
|
|
32
|
+
["A-1001", "Kari Nordmann", 1234.5, true],
|
|
33
|
+
["A-1002", "Ola Nordmann", 99, false],
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
await writeFile(path, bytes);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A row is an array of cells. A cell is a string, a number, a boolean, a `Date`, a Temporal value, or `null` for an empty cell; wrap a value in `{ value, style }` to style it. The result is an ArrayBuffer-backed `Uint8Array`, ready for a file, a `Response` or a `Blob`.
|
|
43
|
+
|
|
44
|
+
## Where it runs
|
|
45
|
+
|
|
46
|
+
### Any web framework, through a Response
|
|
47
|
+
|
|
48
|
+
<!-- snippet: response -->
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { XLSX_MIME_TYPE, writeXlsx } from "xlsx-mini";
|
|
52
|
+
|
|
53
|
+
export default async function report(): Promise<Response> {
|
|
54
|
+
const bytes = await writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
55
|
+
return new Response(bytes, {
|
|
56
|
+
headers: {
|
|
57
|
+
"Content-Type": XLSX_MIME_TYPE,
|
|
58
|
+
"Content-Disposition": 'attachment; filename="report.xlsx"',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Express and friends
|
|
65
|
+
|
|
66
|
+
<!-- snippet: express -->
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { XLSX_MIME_TYPE, writeXlsx } from "xlsx-mini";
|
|
70
|
+
|
|
71
|
+
/** Any response with setHeader and end: Express, Node's http, Fastify's raw reply. */
|
|
72
|
+
interface Reply {
|
|
73
|
+
setHeader(name: string, value: string): void;
|
|
74
|
+
end(body: Uint8Array): void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default async function handler(reply: Reply): Promise<void> {
|
|
78
|
+
const bytes = await writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
79
|
+
reply.setHeader("Content-Type", XLSX_MIME_TYPE);
|
|
80
|
+
reply.setHeader("Content-Disposition", 'attachment; filename="report.xlsx"');
|
|
81
|
+
reply.end(bytes);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Browser
|
|
86
|
+
|
|
87
|
+
The `xlsx-mini/browser` entry adds `downloadXlsx`, which saves the bytes through a download. It throws `NO_DOM` anywhere without a document, so a server never downloads by accident.
|
|
88
|
+
|
|
89
|
+
<!-- snippet: browser -->
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { writeXlsx } from "xlsx-mini";
|
|
93
|
+
import { downloadXlsx } from "xlsx-mini/browser";
|
|
94
|
+
|
|
95
|
+
export default async function exportInBrowser(): Promise<void> {
|
|
96
|
+
const bytes = await writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
97
|
+
downloadXlsx(bytes, "report.xlsx");
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Next.js route handler
|
|
102
|
+
|
|
103
|
+
<!-- snippet: next-route -->
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
// app/api/report/route.ts
|
|
107
|
+
import { XLSX_MIME_TYPE, writeXlsx } from "xlsx-mini";
|
|
108
|
+
|
|
109
|
+
export async function GET(): Promise<Response> {
|
|
110
|
+
const bytes = await writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
111
|
+
return new Response(bytes, {
|
|
112
|
+
headers: {
|
|
113
|
+
"Content-Type": XLSX_MIME_TYPE,
|
|
114
|
+
"Content-Disposition": 'attachment; filename="report.xlsx"',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The same handler on the edge runtime:
|
|
121
|
+
|
|
122
|
+
<!-- snippet: next-edge -->
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
// app/api/report/route.ts on the edge runtime: the same handler, one line more
|
|
126
|
+
import { XLSX_MIME_TYPE, writeXlsx } from "xlsx-mini";
|
|
127
|
+
|
|
128
|
+
export const runtime = "edge";
|
|
129
|
+
|
|
130
|
+
export async function GET(): Promise<Response> {
|
|
131
|
+
const bytes = await writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
132
|
+
return new Response(bytes, { headers: { "Content-Type": XLSX_MIME_TYPE } });
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Next.js server action and client component
|
|
137
|
+
|
|
138
|
+
The action builds the workbook on the server; the client receives the bytes and downloads them.
|
|
139
|
+
|
|
140
|
+
<!-- snippet: actions -->
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// app/actions.ts
|
|
144
|
+
"use server";
|
|
145
|
+
|
|
146
|
+
import { writeXlsx } from "xlsx-mini";
|
|
147
|
+
|
|
148
|
+
export async function exportReport(): Promise<Uint8Array> {
|
|
149
|
+
return writeXlsx({ sheets: [{ name: "Report", rows: [["Total", 42]] }] });
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
<!-- snippet: next-client -->
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
// app/export-button.tsx: wire this to a button's onClick
|
|
157
|
+
"use client";
|
|
158
|
+
|
|
159
|
+
import { downloadXlsx } from "xlsx-mini/browser";
|
|
160
|
+
import { exportReport } from "./actions";
|
|
161
|
+
|
|
162
|
+
export async function onExportClick(): Promise<void> {
|
|
163
|
+
downloadXlsx(await exportReport(), "report.xlsx");
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## From an array of objects
|
|
168
|
+
|
|
169
|
+
`sheetFromObjects` turns objects into a sheet: a bold header row, a frozen header and an autofilter by default, each switchable. A column names a key, and the types reject a key whose values a cell cannot hold; a `value` function computes a cell from the whole object.
|
|
170
|
+
|
|
171
|
+
<!-- snippet: objects -->
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
import { sheetFromObjects, writeXlsx } from "xlsx-mini";
|
|
175
|
+
|
|
176
|
+
interface Order {
|
|
177
|
+
id: string;
|
|
178
|
+
customer: string;
|
|
179
|
+
total: number;
|
|
180
|
+
placed: Date;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default function fromObjects(orders: Order[]): Promise<Uint8Array> {
|
|
184
|
+
const sheet = sheetFromObjects(orders, {
|
|
185
|
+
name: "Orders",
|
|
186
|
+
columns: [
|
|
187
|
+
{ key: "id", header: "Order", width: 12 },
|
|
188
|
+
{ key: "customer", header: "Customer", width: 24 },
|
|
189
|
+
{ key: "total", header: "Total", width: 14, style: { numberFormat: '#,##0.00 "kr"' } },
|
|
190
|
+
{ key: "placed", header: "Placed", width: 18, style: { numberFormat: "yyyy-mm-dd hh:mm" } },
|
|
191
|
+
],
|
|
192
|
+
});
|
|
193
|
+
return writeXlsx({ sheets: [sheet] });
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Number formats
|
|
198
|
+
|
|
199
|
+
A style sets `bold` and a `numberFormat`: an Excel format string, or a built-in format id from 0 to 49. Column styles apply to every cell in the column; a cell's own style wins.
|
|
200
|
+
|
|
201
|
+
<!-- snippet: formats -->
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import { type CellStyle, writeXlsx } from "xlsx-mini";
|
|
205
|
+
|
|
206
|
+
const header: CellStyle = { bold: true };
|
|
207
|
+
const money: CellStyle = { numberFormat: '#,##0.00 "kr"' };
|
|
208
|
+
const percent: CellStyle = { numberFormat: "0.0%" };
|
|
209
|
+
const isoDate: CellStyle = { numberFormat: "yyyy-mm-dd" };
|
|
210
|
+
|
|
211
|
+
export default function formats(): Promise<Uint8Array> {
|
|
212
|
+
return writeXlsx({
|
|
213
|
+
sheets: [
|
|
214
|
+
{
|
|
215
|
+
name: "Invoice",
|
|
216
|
+
// A column style applies to every cell in the column; a cell's own style wins.
|
|
217
|
+
columns: [undefined, { style: money }, { style: percent }, { style: isoDate }],
|
|
218
|
+
rows: [
|
|
219
|
+
[
|
|
220
|
+
{ value: "Item", style: header },
|
|
221
|
+
{ value: "Price", style: header },
|
|
222
|
+
{ value: "VAT", style: header },
|
|
223
|
+
{ value: "Due", style: header },
|
|
224
|
+
],
|
|
225
|
+
["Desk", 4999, 0.25, new Date(Date.UTC(2026, 11, 1))],
|
|
226
|
+
[
|
|
227
|
+
"Chair",
|
|
228
|
+
{ value: 1299.5, style: { numberFormat: "0" } },
|
|
229
|
+
0.25,
|
|
230
|
+
new Date(Date.UTC(2026, 11, 15)),
|
|
231
|
+
],
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
| Want | Format string |
|
|
240
|
+
| --------------------- | ------------------ |
|
|
241
|
+
| Thousands, 2 decimals | `#,##0.00` |
|
|
242
|
+
| Currency after | `#,##0.00 "kr"` |
|
|
243
|
+
| Currency before | `"$"#,##0.00` |
|
|
244
|
+
| Percent | `0.0%` |
|
|
245
|
+
| Whole number | `0` |
|
|
246
|
+
| ISO date | `yyyy-mm-dd` |
|
|
247
|
+
| Date and time | `yyyy-mm-dd hh:mm` |
|
|
248
|
+
| Text as typed | `@` |
|
|
249
|
+
|
|
250
|
+
## Dates and Temporal
|
|
251
|
+
|
|
252
|
+
A `Date` is written as its UTC instant; what the reader shows follows the cell's format, or the built-in date-time format when the cell has none. Temporal values need no polyfill: `Temporal.PlainDate`, `PlainDateTime`, `ZonedDateTime` and `Instant` are recognised by their `Symbol.toStringTag`, and a `PlainDate` gets the built-in date format. Dates run from 1900-01-01 to 9999-12-31, in Excel's 1900 date system.
|
|
253
|
+
|
|
254
|
+
<!-- snippet: dates -->
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
import { writeXlsx } from "xlsx-mini";
|
|
258
|
+
|
|
259
|
+
export default function dates(): Promise<Uint8Array> {
|
|
260
|
+
return writeXlsx({
|
|
261
|
+
sheets: [
|
|
262
|
+
{
|
|
263
|
+
name: "Dates",
|
|
264
|
+
rows: [
|
|
265
|
+
// A Date is written as its UTC instant and shown with the built-in date-time format.
|
|
266
|
+
["Shipped", new Date("2026-11-05T14:30:00Z")],
|
|
267
|
+
// A Temporal.PlainDate shows as a date; PlainDateTime, ZonedDateTime and Instant as
|
|
268
|
+
// date-times. They are recognised by their Symbol.toStringTag, so no polyfill is needed.
|
|
269
|
+
["Due", { [Symbol.toStringTag]: "Temporal.PlainDate", year: 2026, month: 12, day: 1 }],
|
|
270
|
+
],
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Extending accepted value types
|
|
278
|
+
|
|
279
|
+
Augment the `Register` interface with your own types, and the `coerce` option converts each such value once, with its path, into something a cell can hold. `coerce` also sees every `Date` and Temporal value, so it can override how those are written.
|
|
280
|
+
|
|
281
|
+
<!-- snippet: register -->
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
import { type Coerce, writeXlsx } from "xlsx-mini";
|
|
285
|
+
|
|
286
|
+
export class Money {
|
|
287
|
+
constructor(readonly cents: number) {}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Let your own types into cells; the types then accept them everywhere a cell value goes.
|
|
291
|
+
declare module "xlsx-mini" {
|
|
292
|
+
interface Register {
|
|
293
|
+
cellValue: Money | bigint;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Then say how they become something a cell can hold.
|
|
298
|
+
const coerce: Coerce = (value) => {
|
|
299
|
+
if (value instanceof Money) return value.cents / 100;
|
|
300
|
+
if (typeof value === "bigint") return Number(value);
|
|
301
|
+
return value;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export default function extended(): Promise<Uint8Array> {
|
|
305
|
+
return writeXlsx(
|
|
306
|
+
{
|
|
307
|
+
sheets: [
|
|
308
|
+
{
|
|
309
|
+
name: "Ledger",
|
|
310
|
+
rows: [
|
|
311
|
+
["Rent", new Money(1_250_000)],
|
|
312
|
+
["Views", 1234567890123n],
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
{ coerce },
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Errors and limits
|
|
323
|
+
|
|
324
|
+
The writer throws one error class, `XlsxMiniError`, with a `code` to switch on and a `path` into your input such as `sheets[1].rows[40][2]`. It throws before writing anything a reader would refuse.
|
|
325
|
+
|
|
326
|
+
<!-- snippet: errors -->
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
import { XlsxMiniError, writeXlsx } from "xlsx-mini";
|
|
330
|
+
|
|
331
|
+
export default async function safely(): Promise<string> {
|
|
332
|
+
try {
|
|
333
|
+
await writeXlsx({ sheets: [{ name: "Bad/Name", rows: [] }] });
|
|
334
|
+
return "written";
|
|
335
|
+
} catch (error) {
|
|
336
|
+
// code says what, path says where: "INVALID_SHEET_NAME at sheets[0].name"
|
|
337
|
+
if (error instanceof XlsxMiniError) return `${error.code} at ${error.path}`;
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
| Code | When |
|
|
344
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------- |
|
|
345
|
+
| `NO_SHEETS` | The workbook has no sheet. |
|
|
346
|
+
| `INVALID_SHEET_NAME` | Empty, over 31 characters, contains `[ ] : * ? / \`, starts or ends with `'`, or is `History`. |
|
|
347
|
+
| `DUPLICATE_SHEET_NAME` | Two sheets share a name, ignoring case. |
|
|
348
|
+
| `INVALID_NUMBER` | `NaN` or an infinity. |
|
|
349
|
+
| `INVALID_DATE` | An invalid `Date`. |
|
|
350
|
+
| `DATE_OUT_OF_RANGE` | Before 1900-01-01 or after 9999-12-31. |
|
|
351
|
+
| `UNSUPPORTED_VALUE` | A value no cell can hold and `coerce` did not convert. |
|
|
352
|
+
| `INVALID_NUMBER_FORMAT` | A format string outside 1 to 255 characters, or a built-in id outside 0 to 49. |
|
|
353
|
+
| `INVALID_COLUMN_WIDTH` | A width outside 0 to 255. |
|
|
354
|
+
| `INVALID_FREEZE` | Frozen rows or columns outside the sheet. |
|
|
355
|
+
| `CELL_TEXT_TOO_LONG` | Text over 32 767 characters. |
|
|
356
|
+
| `TOO_MANY_COLUMNS` | More than 16 384 cells in a row. |
|
|
357
|
+
| `TOO_MANY_ROWS` | More than 1 048 576 rows. |
|
|
358
|
+
| `PACKAGE_TOO_LARGE` | The file would pass 4 GiB. |
|
|
359
|
+
| `NO_DOM` | `downloadXlsx` called where there is no document. |
|
|
360
|
+
|
|
361
|
+
Empty cells cost nothing: `null`, `undefined` and rows without cells are skipped, and positions stay where you put them.
|
|
362
|
+
|
|
363
|
+
## API
|
|
364
|
+
|
|
365
|
+
| Export | Shape |
|
|
366
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
367
|
+
| `writeXlsx(workbook, options?)` | `Promise<Uint8Array<ArrayBuffer>>` |
|
|
368
|
+
| `WriteOptions` | `{ coerce?: Coerce; compression?: "deflate" \| "none" }`; `"none"` writes STORE entries, byte-identical on every platform |
|
|
369
|
+
| `Workbook` | `{ sheets: readonly Sheet[] }` |
|
|
370
|
+
| `Sheet` | `{ name; rows: Iterable<Row>; columns?: (Column \| undefined)[]; freeze?: Freeze; autoFilter?: boolean }` |
|
|
371
|
+
| `Row`, `Cell` | `readonly Cell[]`; `CellValue \| { value: CellValue; style?: CellStyle }` |
|
|
372
|
+
| `CellValue` | `string \| number \| boolean \| Date \| TemporalLike \| null \| undefined \| Registered` |
|
|
373
|
+
| `CellStyle` | `{ bold?: boolean; numberFormat?: string \| number }` |
|
|
374
|
+
| `Column`, `Freeze` | `{ width?: number; style?: CellStyle }`; `{ rows?: number; columns?: number }` |
|
|
375
|
+
| `Coerce`, `Register`, `Registered` | `(value: Date \| TemporalLike \| Registered, path: string) => CellValue`; the augmentation point and what it holds |
|
|
376
|
+
| `sheetFromObjects(data, options)` | `Sheet`; options `{ name; columns?: ObjectColumn<T>[]; header?: CellStyle \| false; freeze?: boolean; autoFilter?: boolean }` |
|
|
377
|
+
| `XlsxMiniError`, `ErrorCode` | `{ code: ErrorCode; path: string; message }` |
|
|
378
|
+
| `XLSX_MIME_TYPE` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` |
|
|
379
|
+
| `downloadXlsx(bytes, filename)` | from `xlsx-mini/browser`; adds `.xlsx` when the name lacks it |
|
|
380
|
+
|
|
381
|
+
Rows are read once: pass a generator or a database cursor and the writer streams through it, encoding each row as it comes.
|
|
382
|
+
|
|
383
|
+
## Security
|
|
384
|
+
|
|
385
|
+
No runtime dependencies and no install scripts. The writer touches no file, network or global state; it reads what you give it and returns bytes. Text is escaped for XML and characters XML cannot carry are dropped, so cell content cannot break the file. Releases are published through npm trusted publishing with provenance, so every version on npm traces to a commit and a workflow run in this repository. To report a vulnerability, see `SECURITY.md`.
|
|
386
|
+
|
|
387
|
+
## Benchmarks
|
|
388
|
+
|
|
389
|
+
Every pull request gets one comment: the pull request and `main` built and timed on the same runner, in turns, on Node, Bun and Deno, for three suites. `pnpm bench` runs them here. On an Apple M5 Pro with Node 24, the minimum of seven runs:
|
|
390
|
+
|
|
391
|
+
| Suite | Deflate | STORE |
|
|
392
|
+
| -------------------------------------------- | ------: | -----: |
|
|
393
|
+
| Wide table, 100 000 rows by 10 mixed columns | 495 ms | 177 ms |
|
|
394
|
+
| Many sheets, 40 sheets of 2 500 rows by 6 | 238 ms | 74 ms |
|
|
395
|
+
| String-heavy, 200 000 rows by 5 text columns | 367 ms | 90 ms |
|
|
396
|
+
|
|
397
|
+
STORE is the writer's own path; deflate adds the runtime's zlib and is the default. Budgets and the method are in `docs/adr/0021-performance-baseline-and-budgets.md`.
|
|
398
|
+
|
|
399
|
+
## Compatibility
|
|
400
|
+
|
|
401
|
+
Each golden fixture is opened by hand in four applications before a release; `docs/compatibility.md` records how. For the current fixtures:
|
|
402
|
+
|
|
403
|
+
| Fixture | Excel 16.114 (macOS) | Numbers 14.4 | Google Sheets | LibreOffice 26.8 |
|
|
404
|
+
| -------------------------------- | :------------------: | :----------: | :-----------: | :--------------: |
|
|
405
|
+
| Strings and numbers | clean | clean | clean | clean |
|
|
406
|
+
| Every kind of cell value | clean | clean | pending | clean |
|
|
407
|
+
| Deflated entries | clean | clean | pending | clean |
|
|
408
|
+
| Several sheets, escaped names | clean | clean | pending | clean |
|
|
409
|
+
| Styles and number formats | clean | clean | pending | clean |
|
|
410
|
+
| Widths, frozen panes, autofilter | clean | clean | pending | clean |
|
|
411
|
+
| Built from objects | clean | clean | pending | clean |
|
|
412
|
+
|
|
413
|
+
LibreOffice also reads every fixture back cell for cell in CI, on every change.
|
|
414
|
+
|
|
415
|
+
## Contributing
|
|
416
|
+
|
|
417
|
+
Issues and pull requests are welcome; `CONTRIBUTING.md` is short. The design decisions live in `docs/adr/`.
|
|
418
|
+
|
|
419
|
+
## License
|
|
420
|
+
|
|
421
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XLSX_MIME_TYPE } from "./workbook/index.js";
|
|
2
|
+
export { XLSX_MIME_TYPE };
|
|
3
|
+
/**
|
|
4
|
+
* Saves `bytes` as a file through the browser's download mechanism: a `Blob` with the .xlsx media
|
|
5
|
+
* type behind an object URL, clicked through an anchor with a `download` attribute. The `.xlsx`
|
|
6
|
+
* extension is added when `filename` lacks it. Throws `NO_DOM` outside a browser; on a server,
|
|
7
|
+
* return the bytes in a `Response` with `XLSX_MIME_TYPE` instead.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { writeXlsx } from "xlsx-mini";
|
|
11
|
+
* import { downloadXlsx } from "xlsx-mini/browser";
|
|
12
|
+
*
|
|
13
|
+
* downloadXlsx(await writeXlsx(workbook), "orders.xlsx");
|
|
14
|
+
*/
|
|
15
|
+
export declare function downloadXlsx(bytes: Uint8Array, filename: string): void;
|
|
16
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,CAAC;AAQ1B;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAkBtE"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { XlsxMiniError } from "./errors/index.js";
|
|
2
|
+
import { XLSX_MIME_TYPE } from "./workbook/index.js";
|
|
3
|
+
export { XLSX_MIME_TYPE };
|
|
4
|
+
/**
|
|
5
|
+
* How long the object URL outlives the click. Revoking it at once cancels the download in some
|
|
6
|
+
* browsers; forty seconds is the delay FileSaver.js settled on after years of bug reports.
|
|
7
|
+
*/
|
|
8
|
+
const REVOKE_DELAY_MS = 40_000;
|
|
9
|
+
/**
|
|
10
|
+
* Saves `bytes` as a file through the browser's download mechanism: a `Blob` with the .xlsx media
|
|
11
|
+
* type behind an object URL, clicked through an anchor with a `download` attribute. The `.xlsx`
|
|
12
|
+
* extension is added when `filename` lacks it. Throws `NO_DOM` outside a browser; on a server,
|
|
13
|
+
* return the bytes in a `Response` with `XLSX_MIME_TYPE` instead.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { writeXlsx } from "xlsx-mini";
|
|
17
|
+
* import { downloadXlsx } from "xlsx-mini/browser";
|
|
18
|
+
*
|
|
19
|
+
* downloadXlsx(await writeXlsx(workbook), "orders.xlsx");
|
|
20
|
+
*/
|
|
21
|
+
export function downloadXlsx(bytes, filename) {
|
|
22
|
+
if (typeof document === "undefined") {
|
|
23
|
+
throw new XlsxMiniError("NO_DOM", "downloadXlsx", "downloadXlsx needs a browser document; on a server send the bytes in a Response");
|
|
24
|
+
}
|
|
25
|
+
// The writer's output is ArrayBuffer-backed; the Blob constructor insists on that in its types.
|
|
26
|
+
const blob = new Blob([bytes], { type: XLSX_MIME_TYPE });
|
|
27
|
+
const url = URL.createObjectURL(blob);
|
|
28
|
+
const anchor = document.createElement("a");
|
|
29
|
+
anchor.href = url;
|
|
30
|
+
anchor.download = filename.toLowerCase().endsWith(".xlsx") ? filename : `${filename}.xlsx`;
|
|
31
|
+
document.body.append(anchor);
|
|
32
|
+
anchor.click();
|
|
33
|
+
anchor.remove();
|
|
34
|
+
setTimeout(() => URL.revokeObjectURL(url), REVOKE_DELAY_MS);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;;GAGG;AACH,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB,EAAE,QAAgB;IAC9D,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,MAAM,IAAI,aAAa,CACrB,QAAQ,EACR,cAAc,EACd,iFAAiF,CAClF,CAAC;IACJ,CAAC;IACD,gGAAgG;IAChG,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,KAAgC,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACpF,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,OAAO,CAAC;IAC3F,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Every failure the writer reports, as a string literal so callers can switch on it. */
|
|
2
|
+
export type ErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_NUMBER" | "INVALID_DATE" | "DATE_OUT_OF_RANGE" | "UNSUPPORTED_VALUE" | "INVALID_NUMBER_FORMAT" | "INVALID_COLUMN_WIDTH" | "INVALID_FREEZE" | "CELL_TEXT_TOO_LONG" | "TOO_MANY_COLUMNS" | "TOO_MANY_ROWS" | "PACKAGE_TOO_LARGE" | "NO_DOM";
|
|
3
|
+
/**
|
|
4
|
+
* The one error class the writer throws. `code` says what went wrong, `path` says where in the
|
|
5
|
+
* input, as the caller wrote it: `sheets[1].rows[40][2]` is the third cell of the 41st row of the
|
|
6
|
+
* second sheet.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* try {
|
|
10
|
+
* await writeXlsx(workbook);
|
|
11
|
+
* } catch (error) {
|
|
12
|
+
* if (error instanceof XlsxMiniError && error.code === "INVALID_NUMBER") console.log(error.path);
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare class XlsxMiniError extends Error {
|
|
16
|
+
readonly name = "XlsxMiniError";
|
|
17
|
+
readonly code: ErrorCode;
|
|
18
|
+
readonly path: string;
|
|
19
|
+
constructor(code: ErrorCode, path: string, message: string);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,oBAAoB,GACpB,sBAAsB,GACtB,gBAAgB,GAChB,cAAc,GACd,mBAAmB,GACnB,mBAAmB,GACnB,uBAAuB,GACvB,sBAAsB,GACtB,gBAAgB,GAChB,oBAAoB,GACpB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,QAAQ,CAAC;AAEb;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,mBAAmB;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIzD;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one error class the writer throws. `code` says what went wrong, `path` says where in the
|
|
3
|
+
* input, as the caller wrote it: `sheets[1].rows[40][2]` is the third cell of the 41st row of the
|
|
4
|
+
* second sheet.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* try {
|
|
8
|
+
* await writeXlsx(workbook);
|
|
9
|
+
* } catch (error) {
|
|
10
|
+
* if (error instanceof XlsxMiniError && error.code === "INVALID_NUMBER") console.log(error.path);
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export class XlsxMiniError extends Error {
|
|
14
|
+
name = "XlsxMiniError";
|
|
15
|
+
code;
|
|
16
|
+
path;
|
|
17
|
+
constructor(code, path, message) {
|
|
18
|
+
super(`${message} at ${path}`);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.path = path;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;IAChC,IAAI,CAAY;IAChB,IAAI,CAAS;IAEtB,YAAY,IAAe,EAAE,IAAY,EAAE,OAAe;QACxD,KAAK,CAAC,GAAG,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { type ErrorCode, XlsxMiniError } from "./errors/index.js";
|
|
2
|
+
export type { CompressionMode } from "./opc/index.js";
|
|
3
|
+
export { type ObjectColumn, type SheetFromObjectsOptions, sheetFromObjects, } from "./worksheet/index.js";
|
|
4
|
+
export { type WriteOptions, writeXlsx } from "./write-xlsx.js";
|
|
5
|
+
export type { CellStyle } from "./styles/index.js";
|
|
6
|
+
export { type Workbook, XLSX_MIME_TYPE } from "./workbook/index.js";
|
|
7
|
+
export type { Cell, CellObject, CellValue, Coerce, Column, Freeze, Register, Registered, Row, Sheet, TemporalInstantLike, TemporalLike, TemporalPlainDateLike, TemporalPlainDateTimeLike, TemporalZonedDateTimeLike, } from "./worksheet/index.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,YAAY,EACV,IAAI,EACJ,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,EACV,GAAG,EACH,KAAK,EACL,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAGL,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAqB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAiB,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Packaging Conventions container: the zip archive an .xlsx file is.
|
|
3
|
+
* Knows nothing about spreadsheets.
|
|
4
|
+
*/
|
|
5
|
+
export { type CompressionMode, selectCompression, store } from "./lib/compression.js";
|
|
6
|
+
export { crc32 } from "./lib/crc32.js";
|
|
7
|
+
export { createPackage, type PackagePart } from "./lib/zip.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Packaging Conventions container: the zip archive an .xlsx file is.
|
|
3
|
+
* Knows nothing about spreadsheets.
|
|
4
|
+
*/
|
|
5
|
+
export { selectCompression, store } from "./lib/compression.js";
|
|
6
|
+
export { crc32 } from "./lib/crc32.js";
|
|
7
|
+
export { createPackage } from "./lib/zip.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAwB,iBAAiB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** How entries are stored in the package: the zip method id and the transform that produces them. */
|
|
2
|
+
export interface Compression {
|
|
3
|
+
/** Zip method: 0 for STORE, 8 for DEFLATE. */
|
|
4
|
+
readonly method: 0 | 8;
|
|
5
|
+
compress(data: Uint8Array): Promise<Uint8Array>;
|
|
6
|
+
}
|
|
7
|
+
/** What a caller may ask for. The runtime may still force STORE when it cannot deflate. */
|
|
8
|
+
export type CompressionMode = "deflate" | "none";
|
|
9
|
+
/** STORE: bytes go in as they are. Byte-deterministic on every platform. */
|
|
10
|
+
export declare const store: Compression;
|
|
11
|
+
/**
|
|
12
|
+
* Picks the strategy for a requested mode. Deflate is confirmed by constructing the stream, not by
|
|
13
|
+
* checking that the class exists: some runtimes list `deflate-raw` without implementing it. Where
|
|
14
|
+
* it is unavailable the package is written with STORE entries instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectCompression(mode: CompressionMode): Compression;
|
|
17
|
+
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../../src/opc/lib/compression.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACjD;AAED,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjD,4EAA4E;AAC5E,eAAO,MAAM,KAAK,EAAE,WAGnB,CAAC;AAQF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAQpE"}
|