0

What would be the most efficient way to handle unzipping of a file and storing then uploading the unzipped file to Supabase? There is no server-side available for SupaBase, so should I host an API elswhere that takes care of the unzipping part and eventually uploads the extracted file to SupaBase?

Mario84
  • 33
  • 2
  • 9

1 Answers1

1

Small Files (Supabase Only Solution)

For small files, you can create an Edge Function that uses a decompression stream:

const src = await Deno.open("./testdata/singleFile.txt.gz");
const dest = await Deno.open("./testdata/singleFile.txt", {
  create: true,
  write: true,
});
src.readable
  .pipeThrough(new DecompressionStream("gzip"))
  .pipeTo(dest.writable);

Then you can use this stream to pass the object to Supabase by tweaking this upload to storage example to take this decompression stream.

Large Files:

For large files, then it would probably be a better idea to create a server to extract and then upload it to Supabase Storage after the extraction was completed.

Mansueli
  • 6,223
  • 8
  • 33
  • 57