Fix remaining(?) crashes= in our code

This commit is contained in:
Starbeamrainbowlabs 2022-05-19 19:13:28 +01:00
parent 3cb7e42505
commit e030e6c2d5
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 9 additions and 5 deletions

View file

@ -506,7 +506,7 @@
"node_modules/browserify-zlib": { "node_modules/browserify-zlib": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz",
"integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==",
"dependencies": { "dependencies": {
"pako": "~0.2.0" "pako": "~0.2.0"
} }
@ -2068,7 +2068,7 @@
"browserify-zlib": { "browserify-zlib": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz",
"integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==",
"requires": { "requires": {
"pako": "~0.2.0" "pako": "~0.2.0"
} }

View file

@ -20,14 +20,18 @@ class Terrain50StreamReader {
async *iterate(filepath) { async *iterate(filepath) {
const reader = fs.createReadStream(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; let i = -1;
for await (const next of stream) { for await (const next of stream) {
i++; i++;
console.log(`Terrain50 STEP ${i}`);
// Skip the first few items, because we want to predict the water // Skip the first few items, because we want to predict the water
// depth after the rainfall radar data // depth after the rainfall radar data
if(i < this.offset) if(i < this.offset)