0

I have a Gzip object stored in a variable. However, I want to save that to a file.

This file is Gzip object (not stream, string or buffer).

function(params) {
                const gzipObject = params.Object;
                // save this to a file
                return {
                    promise: function() {
                        return true;
                    }
                }
            }

This is code from test case, however the value is created like this:

    const body = await s3.getObject(params).createReadStream()
        .pipe(zlib.createGunzip())
        .pipe(new stream.Transform({
            transform
        }))
        .pipe(zlib.createGzip());

    await s3.upload({
        Bucket: "mybucket",
        Key: anonymizedKey,
        Body: body
    }).promise();

// The body is the instance of Gzip

I tried stream, fs.writeFile but they throw error similar to this. TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Gzip

Note: Its available as instance of Gzip and I want to write it to a file.

0 Answers0