diff --git a/lib/manager/pageWriterStream.js b/lib/manager/pageWriterStream.js index 77fda49..98ac7a3 100644 --- a/lib/manager/pageWriterStream.js +++ b/lib/manager/pageWriterStream.js @@ -54,10 +54,14 @@ module.exports = class pageWriterStream extends Writable { } _final(done) { - this._wstream.on('finish', () => { - done(); - }); - this._gzip.end(); + if (this._wstream) { + this._wstream.on('finish', () => { + done(); + }); + } + if (this._gzip) { + this._gzip.end(); + } } initWriter() { diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 3c22b82..d15e187 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -53,7 +53,9 @@ module.exports = new class Utils { return new Promise(async (resolve, reject) => { try { const res = await this.download(url, headers); - const lastModified = res.headers['last-modified'] ? new Date(res.headers['last-modified']).toISOString() : new Date().toISOString(); + const lastModified = res.headers['last-modified'] + ? new Date(res.headers['last-modified']).toISOString() + : new Date().toISOString(); const fileName = `${path}/${lastModified}.zip`; const writer = fs.createWriteStream(fileName, { encoding: 'base64' }); diff --git a/package.json b/package.json index 1d1180b..746cf3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "linked-connections-server", - "version": "1.3.3", + "version": "1.3.4", "author": "Julian Rojas", "license": "MIT", "repository": { @@ -11,7 +11,7 @@ "url": "https://github.com/linkedconnections/linked-connections-server/issues" }, "scripts": { - "test": "jest", + "test": "jest --coverage", "coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls" }, "dependencies": { @@ -24,9 +24,9 @@ "del": "^5.1.0", "express": "^4.17.1", "fast-csv": "^4.1.1", - "gtfs2lc": "^2.1.9", - "gtfsrt2lc": "^2.0.5", - "jsonld": "^5.2.0", + "gtfs2lc": "^2.2.0", + "gtfsrt2lc": "^2.1.3", + "jsonld": "^8.1.1", "md5": "^2.2.1", "morgan": "^1.9.1", "n3": "^1.3.5",