0

I have a load of files within a folder which I need to upload to firebase storage programmatically (the files are HLS chunks created using ffmpeg).

A simplified version of the folder structure follows (where temp represents the OS temp folder)

temp/
  my-video/
    v0/
      chunk0.ts
      chunk1.ts
      index.m3u8
    v1/
      chunk0.ts
      chunk1.ts
      index.m3u8
    master.m3u8

I want to upload these to storage as a folder in one hit and maintain the folder structure within storage such that within storage the structure will be:

videos-out/
  test-videos/
    my-video/
      v0/
        chunk0.ts
        chunk1.ts
        index.m3u8
      v1/
        chunk0.ts
        chunk1.ts
        index.m3u8
      master.m3u8

Is is possible to upload the folder in one hit and if so how? I can't see anything about this in the docs. Or do I just need to mess about with individual files and upload them one by one iteratively as discussed here - How to upload multiple files to Firebase?

TIA

danday74
  • 52,471
  • 49
  • 232
  • 283
  • 1
    Can you get absolute path to each file? For example, `temp/my-video/v0/chunk0.ts`. Uploading a file to this path will create those folders. Also which language are you using ? – Dharmaraj Oct 21 '21 at 10:23
  • 2
    Technically there aren't any folders in Firebase storage. They are rendered that way in browser console based on the path. There isn't any API to upload a directory itself as far as I know. You'll have to upload each file individually. – Dharmaraj Oct 21 '21 at 10:34
  • Solution here - https://stackoverflow.com/a/69669345/1205871 – danday74 Oct 21 '21 at 22:32

0 Answers0