我一直在尝试连接到我的 Azure 存储帐户,但我在使用 azure-storage 模块时遇到一些问题。具体来说,一旦我创建了一个 TableService 对象,该对象就只有一个过滤方法。我尝试过的两种方法是 queryTables 和 createTableIfNotExist。例如,createTableIfNotExist 返回“TypeError:aztd.createTableIfNotExistis 不是函数”。源代码如下。
var azure = require('azure-storage');
var aztd = azure.createTableService();
var azseg = azure.TableUtilities.entityGenerator;
console.log("AZSEG " + Object.getOwnPropertyNames(azseg).filter(function (p) { return typeof azseg[p] === 'function'; }));
console.log("AZTD " + Object.getOwnPropertyNames(aztd).filter(function (p) { return typeof aztd[p] === 'function'; }));
aztd.createTableIfNotExist('table1', function (e, result, res) {
if (result) console.log('Table created');
});
除了找不到函数之外,我没有收到任何其他错误。控制台日志返回两个变量的函数:
AZSEG Entity,Int32,Int64,Binary,Boolean,String,Guid,Double,DateTime
AZTD filter
我可以看到实体生成器创建得很好,但是我是否缺少 TableService 的任何内容?
最佳答案
实际上,函数名应该是createTableIfNotExists
,并且您似乎输入了无效的函数名称。
也可以引用azure-storage-node的源码在 github 上获取所有函数的信息。
关于javascript - Node.js azure-storage TableService 没有方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34518912/