skiz-parser 2.2.1 → 3.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.
Files changed (2) hide show
  1. package/index.js +9 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import csv from 'csv-parser';
2
2
  import { XMLParser } from 'fast-xml-parser';
3
- import { promisify } from 'util';
4
3
  import yauzl from 'yauzl';
5
4
 
6
5
  const parser = new XMLParser({
@@ -23,6 +22,14 @@ const convertReadStreamToBuffer = (readStream) => {
23
22
  });
24
23
  };
25
24
 
25
+ const openReadStream = (zipFile, entry) => {
26
+ return new Promise((resolve, reject) => {
27
+ zipFile.openReadStream(entry, (err, readStream) => {
28
+ err ? reject(err) : resolve(readStream);
29
+ });
30
+ });
31
+ };
32
+
26
33
  const parseBatteryCsvFile = (readStream) => {
27
34
  return new Promise((resolve, reject) => {
28
35
  const batteryUsage = [];
@@ -219,8 +226,6 @@ export const parseSkizFile = (contents, callback) => {
219
226
 
220
227
  let data = {};
221
228
 
222
- const openReadStream = promisify(zipFile.openReadStream.bind(zipFile));
223
-
224
229
  zipFile.readEntry();
225
230
 
226
231
  zipFile
@@ -239,7 +244,7 @@ export const parseSkizFile = (contents, callback) => {
239
244
  return zipFile.readEntry();
240
245
  }
241
246
 
242
- const readStream = await openReadStream(entry);
247
+ const readStream = await openReadStream(zipFile, entry);
243
248
 
244
249
  let result;
245
250
  if (entry.fileName === 'Battery.csv') {
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": "2.2.1",
4
+ "version": "3.0.1",
5
5
  "author": "Kirk Eaton <contact@kirkeaton.ca>",
6
6
  "ava": {
7
7
  "files": [
@@ -27,7 +27,7 @@
27
27
  "tsd": "0.28.1"
28
28
  },
29
29
  "engines": {
30
- "node": ">=14"
30
+ "node": ">=16"
31
31
  },
32
32
  "exports": "./index.js",
33
33
  "files": [