skiz-parser 1.6.1 → 1.8.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.
- package/index.js +25 -0
- package/package.json +9 -8
package/index.js
CHANGED
|
@@ -72,6 +72,28 @@ const parseNodeCsvFile = (readStream) => {
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const parseRelativeAltitudeSensorCsvFile = (readStream) => {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
const relativeAltitude = [];
|
|
78
|
+
|
|
79
|
+
readStream
|
|
80
|
+
.pipe(csv({ headers: false }))
|
|
81
|
+
.on('error', reject)
|
|
82
|
+
.on('data', (data) => {
|
|
83
|
+
const values = Object.values(data);
|
|
84
|
+
|
|
85
|
+
relativeAltitude.push({
|
|
86
|
+
timestamp: new Date(parseFloat(values[0]) * 1000.0),
|
|
87
|
+
pressure: parseFloat(values[1]),
|
|
88
|
+
relativeAltitude: parseFloat(values[2]),
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
.once('end', () => {
|
|
92
|
+
resolve({ relativeAltitude });
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
75
97
|
const parseSegmentCsvFile = (readStream) => {
|
|
76
98
|
return new Promise((resolve, reject) => {
|
|
77
99
|
const trackSegments = [];
|
|
@@ -209,6 +231,7 @@ export const parseSkizFile = (contents, callback) => {
|
|
|
209
231
|
'Battery.csv',
|
|
210
232
|
'Events.xml',
|
|
211
233
|
'Nodes.csv',
|
|
234
|
+
'RelativeAltitudeSensor.csv',
|
|
212
235
|
'Segment.csv',
|
|
213
236
|
'Track.xml',
|
|
214
237
|
].includes(entry.fileName)
|
|
@@ -225,6 +248,8 @@ export const parseSkizFile = (contents, callback) => {
|
|
|
225
248
|
result = await parseEventsXmlFile(readStream);
|
|
226
249
|
} else if (entry.fileName === 'Nodes.csv') {
|
|
227
250
|
result = await parseNodeCsvFile(readStream);
|
|
251
|
+
} else if (entry.fileName === 'RelativeAltitudeSensor.csv') {
|
|
252
|
+
result = await parseRelativeAltitudeSensorCsvFile(readStream);
|
|
228
253
|
} else if (entry.fileName === 'Segment.csv') {
|
|
229
254
|
result = await parseSegmentCsvFile(readStream);
|
|
230
255
|
} else if (entry.fileName === 'Track.xml') {
|
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.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"author": "Kirk Eaton <contact@kirkeaton.ca>",
|
|
6
6
|
"ava": {
|
|
7
7
|
"files": [
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
"url": "https://github.com/kirkeaton/skiz-parser/issues"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"csv-parser": "
|
|
17
|
-
"fast-xml-parser": "
|
|
18
|
-
"yauzl": "
|
|
16
|
+
"csv-parser": "3.0.0",
|
|
17
|
+
"fast-xml-parser": "4.0.7",
|
|
18
|
+
"yauzl": "2.10.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"ava": "
|
|
22
|
-
"husky": "
|
|
23
|
-
"lint-staged": "
|
|
24
|
-
"prettier": "
|
|
21
|
+
"ava": "4.1.0",
|
|
22
|
+
"husky": "7.0.4",
|
|
23
|
+
"lint-staged": "12.3.7",
|
|
24
|
+
"prettier": "2.6.1",
|
|
25
|
+
"semantic-release": "19.0.2"
|
|
25
26
|
},
|
|
26
27
|
"engines": {
|
|
27
28
|
"node": ">=12"
|