|
|
@ -11,12 +11,16 @@ const reportFilename = "report.json.gz"; |
|
|
|
|
|
|
|
|
|
|
|
const writeReport = (releaseDir, err, result, callback) => { |
|
|
|
const writeReport = (releaseDir, err, result, callback) => { |
|
|
|
const readable = new streamBuffers.ReadableStreamBuffer(); |
|
|
|
const readable = new streamBuffers.ReadableStreamBuffer(); |
|
|
|
|
|
|
|
const writeStream = fs.createWriteStream(path.join(releaseDir, reportFilename)); |
|
|
|
|
|
|
|
|
|
|
|
readable |
|
|
|
readable |
|
|
|
.pipe(zlib.createGzip()) |
|
|
|
.pipe(zlib.createGzip()) |
|
|
|
.pipe(fs.createWriteStream(path.join(releaseDir, reportFilename))) |
|
|
|
.pipe(writeStream) |
|
|
|
.on("error", callback) |
|
|
|
.on("error", callback) |
|
|
|
.on("finish", callback); |
|
|
|
.on("finish", () => { |
|
|
|
|
|
|
|
writeStream.close(); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
readable.put(JSON.stringify({ |
|
|
|
readable.put(JSON.stringify({ |
|
|
|
"date": Date.now(), |
|
|
|
"date": Date.now(), |
|
|
@ -35,6 +39,8 @@ const readReport = (releaseDir, callback) => { |
|
|
|
.pipe(writable) |
|
|
|
.pipe(writable) |
|
|
|
.on("error", callback) |
|
|
|
.on("error", callback) |
|
|
|
.on("finish", () => { |
|
|
|
.on("finish", () => { |
|
|
|
|
|
|
|
readStream.destroy(); |
|
|
|
|
|
|
|
|
|
|
|
const data = writable.getContentsAsString(); |
|
|
|
const data = writable.getContentsAsString(); |
|
|
|
|
|
|
|
|
|
|
|
if (!data) { |
|
|
|
if (!data) { |
|
|
@ -45,6 +51,8 @@ const readReport = (releaseDir, callback) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.readReport = readReport; |
|
|
|
|
|
|
|
|
|
|
|
exports.writeReport = writeReport; |
|
|
|
exports.writeReport = writeReport; |
|
|
|
|
|
|
|
|
|
|
|
exports.loadReport = (app, options, callback) => { |
|
|
|
exports.loadReport = (app, options, callback) => { |
|
|
|