skiz-parser 1.6.0 → 1.6.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/index.js +8 -13
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import csv from 'csv-parser';
|
|
2
|
-
import
|
|
2
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
3
3
|
import { promisify } from 'util';
|
|
4
4
|
import yauzl from 'yauzl';
|
|
5
5
|
|
|
6
|
+
const parser = new XMLParser({
|
|
7
|
+
attributeNamePrefix: '',
|
|
8
|
+
ignoreAttributes: false,
|
|
9
|
+
});
|
|
10
|
+
|
|
6
11
|
const convertReadStreamToBuffer = (readStream) => {
|
|
7
12
|
return new Promise((resolve, reject) => {
|
|
8
13
|
const chunks = [];
|
|
@@ -109,13 +114,8 @@ const parseSegmentCsvFile = (readStream) => {
|
|
|
109
114
|
};
|
|
110
115
|
|
|
111
116
|
const parseTrackXmlFile = async (readStream) => {
|
|
112
|
-
const options = {
|
|
113
|
-
attributeNamePrefix: '',
|
|
114
|
-
ignoreAttributes: false,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
117
|
const buffer = await convertReadStreamToBuffer(readStream);
|
|
118
|
-
const parsed =
|
|
118
|
+
const parsed = parser.parse(buffer.toString('utf-8'));
|
|
119
119
|
|
|
120
120
|
const track = parsed.track;
|
|
121
121
|
const metrics = track.metrics;
|
|
@@ -171,13 +171,8 @@ const parseTrackXmlFile = async (readStream) => {
|
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
const parseEventsXmlFile = async (readStream) => {
|
|
174
|
-
const options = {
|
|
175
|
-
attributeNamePrefix: '',
|
|
176
|
-
ignoreAttributes: false,
|
|
177
|
-
};
|
|
178
|
-
|
|
179
174
|
const buffer = await convertReadStreamToBuffer(readStream);
|
|
180
|
-
const parsed =
|
|
175
|
+
const parsed = parser.parse(buffer.toString('utf-8'));
|
|
181
176
|
|
|
182
177
|
const events = parsed.events.event || [];
|
|
183
178
|
const trackEvents = events.map((event) => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skiz-parser",
|
|
3
3
|
"description": "Parse a .skiz file exported from Ski Tracks",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"author": "Kirk Eaton <contact@kirkeaton.ca>",
|
|
6
6
|
"ava": {
|
|
7
7
|
"files": [
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"csv-parser": "^3.0.0",
|
|
17
|
-
"fast-xml-parser": "^
|
|
17
|
+
"fast-xml-parser": "^4.0.1",
|
|
18
18
|
"yauzl": "^2.10.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"ava": "^
|
|
21
|
+
"ava": "^4.0.1",
|
|
22
22
|
"husky": "^7.0.0",
|
|
23
|
-
"lint-staged": "^
|
|
23
|
+
"lint-staged": "^12.1.4",
|
|
24
24
|
"prettier": "^2.2.1"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|