From e030e6c2d5060a428516752cfa1db97834735cee Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 19 May 2022 19:13:28 +0100 Subject: [PATCH] Fix remaining(?) crashes= in our code --- rainfallwrangler/package-lock.json | 4 ++-- rainfallwrangler/src/lib/io/Terrain50StreamReader.mjs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rainfallwrangler/package-lock.json b/rainfallwrangler/package-lock.json index 59d8dbf..41a9d49 100644 --- a/rainfallwrangler/package-lock.json +++ b/rainfallwrangler/package-lock.json @@ -506,7 +506,7 @@ "node_modules/browserify-zlib": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", "dependencies": { "pako": "~0.2.0" } @@ -2068,7 +2068,7 @@ "browserify-zlib": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", "requires": { "pako": "~0.2.0" } diff --git a/rainfallwrangler/src/lib/io/Terrain50StreamReader.mjs b/rainfallwrangler/src/lib/io/Terrain50StreamReader.mjs index 22b1aae..385c32c 100644 --- a/rainfallwrangler/src/lib/io/Terrain50StreamReader.mjs +++ b/rainfallwrangler/src/lib/io/Terrain50StreamReader.mjs @@ -20,14 +20,18 @@ class Terrain50StreamReader { async *iterate(filepath) { const reader = fs.createReadStream(filepath); - const extractor = gunzip(); - reader.pipe(extractor); - const stream = Terrain50.ParseStream(new Readable(extractor), this.tolerant ? /\s+/ : " "); + const stream = Terrain50.ParseStream( + new Readable().wrap(reader.pipe(gunzip())), + this.tolerant ? /\s+/ : " " + ); let i = -1; for await (const next of stream) { i++; + + console.log(`Terrain50 STEP ${i}`); + // Skip the first few items, because we want to predict the water // depth after the rainfall radar data if(i < this.offset)