在云端功能中,如何获取存储文件的download-url?
public static void Main(string[] args)
{
// NLog: setup the logger first to catch all errors
var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
try
{
logger.Debug("init main");
BuildWebHost(args).Run();
}
catch (Exception ex)
{
//NLog: catch setup errors
logger.Error(ex, "Stopped program because of exception");
throw;
}
finally
{
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
NLog.LogManager.Shutdown();
}
}
使用此存储对象,我可以执行const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const storage = admin.storage();
,但返回的元数据不包含firebase-signed-download-url。
The docs说创建引用并执行storage.bucket().file(path).getMetadata()
。唯一的问题是,这似乎不适用于从firebase-admin软件包返回的存储对象。