gpt4 book ai didi

Azure Cosmos DB 在存储过程中解码 base64

转载 作者:行者123 更新时间:2023-12-03 02:38:46 25 4
gpt4 key购买 nike

我需要在 Azure CosmosDB 的存储过程中解码 Base64 编码的字符串。我尝试使用以下函数,但对于每个函数,我都收到未定义的错误:

我最终使用 this algorithm 创建了一个自定义函数,但这似乎不是一个好的做法。

有内置函数吗?

var defaultGroupId = groupIds.filter(id => {
// atob(id); base64_decode_tostring(id); are not working
let decoded = base64_decode(id);
return decoded.indexOf(defaultGroupIndicator) == 0;
});

function base64_decode(s) {
// took from the link above;
}

最佳答案

除了作为 JS 规范本身的一部分提供的实用方法外,我们不提供实用方法。 btoa 和 atob 不属于其中。如果您需要此功能,那么最好的(唯一的)选择是使用任何可用的开源实现。

我还想指出,如果您使用存储过程进行大量读取,您可能需要重新考虑这一点。执行大量批量写入时最好使用存储过程。存储过程仅在我们的四个副本集中的主副本上运行。因此,当所有读取都在主副本上并且不使用任何辅助副本时,您将看不到所有预配置的吞吐量。

希望有帮助。

关于Azure Cosmos DB 在存储过程中解码 base64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62196287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com