简体   繁体   English

用于 JavaScript 的 Azure 函数命令式绑定

[英]Azure functions imperative binding for javascript

I have an Azure Function that writes to a blob.我有一个写入 blob 的 Azure 函数。 Specifically, I need the path I save to, to be comprised of the UTC date (for example yy/MM/dd/hh:mm:ss).具体来说,我需要保存到的路径由 UTC 日期组成(例如 yy/MM/dd/hh:mm:ss)。 In my case, I am using function.json to achieve this: { "type": "blob", "name": "outputBlob", "path": "myContainer/{datetime:yyyy}/{datetime:MM}/{datetime:dd}/{datetime:hh}-{datetime:mm}-{datetime:ss}", "connection": "smth_STORAGE", "direction": "out" }就我而言,我使用 function.json 来实现这一点: { "type": "blob", "name": "outputBlob", "path": "myContainer/{datetime:yyyy}/{datetime:MM}/{datetime:dd}/{datetime:hh}-{datetime:mm}-{datetime:ss}", "connection": "smth_STORAGE", "direction": "out" }

However, I want more flexibility with it.但是,我想要更多的灵活性。 I need the time to be UTC (which time does it use by default?).我需要时间为 UTC(默认使用哪个时间?)。 The {datetime:XXXX} is not documented anywhere and I found it on another stackoverflow question, but for the sake of the general need, how would I achieve more flexibility with the output filename when using javascript for the Azure Function? {datetime:XXXX} 没有记录在任何地方,我在另一个 stackoverflow 问题上找到了它,但出于一般需要,在将 javascript 用于 Azure 函数时,如何通过输出文件名实现更大的灵活性?

Firstly there is the document about DateTime binding, the DateTime resolves to DateTime.UtcNow, so yes the time is UTC.首先是关于DateTime绑定的文档,DateTime解析为DateTime.UtcNow,所以时间是UTC。 For more information you could refer to this doc: Current time .有关更多信息,您可以参考此文档: 当前时间

Then is about flexibility, you need provide more information, you want to bind it at runtime, provide by http request or other way you want.然后是关于灵活性,您需要提供更多信息,您希望在运行时绑定它,通过 http 请求或其他您想要的方式提供。 Cause you are using nodejs, there are many limits.因为您使用的是 nodejs,所以有很多限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM