Say i have the two buffers:
const bufferFile1 = Buffer.from('Hello World!', 'utf-8')
const bufferFile2 = Buffer.from('Hello Again World!', 'utf-8')
How can i create tarball file buffer/stream/blob (not written to disk) where the the two buffers above should be stored as two files in the tarball. I would like to (be able to) pipe the tarball as a response to a request.
I have looked into using the tar package. But this solution requires paths instead of in memory streams/buffers.
Is it at all possible to accomplish this?
PS: I have very little experience with in memory file handling.
The overall project is to create an api endpoint
- takes in parameters either as POST body or url query parameters.
- creates a set of in memory files with content based on input
- creates a tar.gz file based on these files
- stores the tar.gz file in mongodb using GridFS
I dont really have a place to store the files temporarily (serverless environment), thats why i want the solution to be completely in memory.