0

Someone know how to create a empty folder in firebase storage with JS ?

I try to search a solution in the docs but i dont find anythings

1 Answers1

1

A directory is automatically created once you create a reference and upload a file. According to the docs, you can use:

import { getStorage, ref } from "firebase/storage";

const storage = getStorage();

const spaceRef = ref(storage, 'images/space.jpg');
//                              

Where "images" is a top-level directory inside Firebase Storage.

If you only want an empty folder, go ahead in open the console, select Storage from the "Build" section, and then hit "create folder".

enter image description here

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • there is a mode to create a empty folder from JS code ? – Leonardo Rocchini Oct 27 '22 at 14:58
  • What would you like to create an empty folder programmatically? Why don't you simply create it in the Firebase console? But to answer your question, no, there is no function present that can help you create just an empty folder. – Alex Mamo Oct 27 '22 at 16:43
  • Thanks Alex. I built a front-end file system, with Firebase storage back-end where the user can manage his files and folders I am looking for a way for the user to create a empty folder. – Leonardo Rocchini Oct 31 '22 at 13:43
  • I don't see any reason why you would create an empty folder, as long as it is created automatically when the user uploads the first file. If you delete the file, the folder remains empty, if this what you want. – Alex Mamo Oct 31 '22 at 15:36
  • So can I help you with other information? – Alex Mamo Oct 31 '22 at 15:37