bucket.upload(path, function(err, file) {
return "https://firebasestorage.googleapis.com/v0/b/" + projectId + ".appspot.com/o/" + file.metadata.name + "?alt=media");
});
}
I want to return the url when calling uploadFile(path) so console.log(uploadFile("some/path/to/file.txt")); prints the url.
How do I do that?
const uploadFile = (path) => new Promise(( resolve, reject )=> bucket.upload(path, ( err, file ) => { if (err) reject(err); else resolve(file); }));
Обсуждают сегодня