read-excel-file 5.2.19 → 5.2.23
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/CHANGELOG.md +5 -0
- package/README.md +38 -1
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/read/readXlsx.js +14 -6
- package/commonjs/read/readXlsx.js.map +1 -1
- package/commonjs/read/readXlsxFileNode.js +2 -2
- package/commonjs/read/readXlsxFileNode.js.map +1 -1
- package/commonjs/read/readXlsxFileWebWorker.js +29 -0
- package/commonjs/read/readXlsxFileWebWorker.js.map +1 -0
- package/commonjs/xml/{xmlNode.js → xml.js} +1 -1
- package/commonjs/xml/xml.js.map +1 -0
- package/commonjs/xml/xmlBrowser.js +3 -0
- package/commonjs/xml/xmlBrowser.js.map +1 -1
- package/modules/read/readXlsx.js +14 -6
- package/modules/read/readXlsx.js.map +1 -1
- package/modules/read/readXlsxFileNode.js +1 -1
- package/modules/read/readXlsxFileNode.js.map +1 -1
- package/modules/read/readXlsxFileWebWorker.js +18 -0
- package/modules/read/readXlsxFileWebWorker.js.map +1 -0
- package/modules/xml/{xmlNode.js → xml.js} +1 -1
- package/modules/xml/xml.js.map +1 -0
- package/modules/xml/xmlBrowser.js +3 -0
- package/modules/xml/xmlBrowser.js.map +1 -1
- package/node/package.json +1 -1
- package/package.json +2 -2
- package/schema/package.json +1 -1
- package/types.d.ts +1 -1
- package/web-worker/index.commonjs.js +6 -0
- package/web-worker/index.d.ts +1 -0
- package/web-worker/index.js +5 -0
- package/web-worker/package.json +9 -0
- package/commonjs/xml/xmlNode.js.map +0 -1
- package/modules/xml/xmlNode.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* Added [TypeScript](https://github.com/catamphetamine/read-excel-file/issues/71) definitions.
|
|
6
6
|
-->
|
|
7
7
|
|
|
8
|
+
5.2.22 / 11.11.2021
|
|
9
|
+
==================
|
|
10
|
+
|
|
11
|
+
* [Added](https://github.com/catamphetamine/read-excel-file/issues/100) `/web-worker` export
|
|
12
|
+
|
|
8
13
|
5.2.11 / 08.10.2021
|
|
9
14
|
==================
|
|
10
15
|
|
package/README.md
CHANGED
|
@@ -50,10 +50,47 @@ readXlsxFile('/path/to/file').then((rows) => {
|
|
|
50
50
|
|
|
51
51
|
// Readable Stream.
|
|
52
52
|
readXlsxFile(fs.createReadStream('/path/to/file')).then((rows) => {
|
|
53
|
-
|
|
53
|
+
// `rows` is an array of rows
|
|
54
|
+
// each row being an array of cells.
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Web Worker
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
const worker = new Worker('web-worker.js')
|
|
62
|
+
|
|
63
|
+
worker.onmessage = function(event) {
|
|
64
|
+
// `event.data` is an array of rows
|
|
65
|
+
// each row being an array of cells.
|
|
66
|
+
console.log(event.data)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
worker.onerror = function(event) {
|
|
70
|
+
console.error(event.message)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const input = document.getElementById('input')
|
|
74
|
+
|
|
75
|
+
input.addEventListener('change', () => {
|
|
76
|
+
worker.postMessage(input.files[0])
|
|
54
77
|
})
|
|
55
78
|
```
|
|
56
79
|
|
|
80
|
+
##### `web-worker.js`
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import readXlsxFile from 'read-excel-file/web-worker'
|
|
84
|
+
|
|
85
|
+
onmessage = function(event) {
|
|
86
|
+
readXlsxFile(event.data).then((rows) => {
|
|
87
|
+
// `rows` is an array of rows
|
|
88
|
+
// each row being an array of cells.
|
|
89
|
+
postMessage(rows)
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
57
94
|
## JSON
|
|
58
95
|
|
|
59
96
|
To convert table rows to JSON objects, pass a `schema` option to `readXlsxFile()`. It will return `{ rows, errors }` object instead of just `rows`.
|