mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-10 06:44:13 +00:00
trying to write a new file temp
This commit is contained in:
parent
4fccdcbd7c
commit
746987af7b
1 changed files with 5 additions and 3 deletions
8
app.js
8
app.js
|
@ -218,10 +218,11 @@ async function get_app_server() {
|
|||
const bucket = storage.bucket(process.env.BUCKET_NAME);
|
||||
//compressing the file using gzip
|
||||
const gzip = zlib.createGzip();
|
||||
const gzipTempFileName = multer_temp_image_path + ".gz";
|
||||
const tempFileWriteStream = fs.createWriteStream(gzipTempFileName);
|
||||
input_read_stream.pipe(gzip).pipe(tempFileWriteStream);
|
||||
//uploading the gzipped file to GCS
|
||||
console.log("hi");
|
||||
const gzippedStream = input_read_stream.pipe(gzip);
|
||||
await bucket.upload(gzippedStream, {
|
||||
await bucket.upload(gzipTempFileName, {
|
||||
gzip: true,
|
||||
destination: payload_fire_image_filename,
|
||||
metadata: {
|
||||
|
@ -230,6 +231,7 @@ async function get_app_server() {
|
|||
});
|
||||
console.log(`${fileName} has been uploaded to GCS.`);
|
||||
await asyncfs.unlink(multer_temp_image_path);
|
||||
await asyncfs.unlink(gzipTempFileName);
|
||||
}else{
|
||||
input_read_stream.pipe(gzip).pipe(output_gzip_stream).on('finish', async (error) => {
|
||||
if(error) {
|
||||
|
|
Loading…
Reference in a new issue