Node.js azure存储TableService没有方法

Node.js azure-storage TableService has no methods

本文关键字:有方法 TableService 存储 js azure Node      更新时间:2023-09-26

我一直在尝试连接到我的Azure存储帐户,但我在Azure存储模块上遇到了一些问题。具体来说,一旦我创建了一个TableService对象,该对象上就只有一个filter方法。我尝试过的两个方法是queryTables和createTableIfNotExist。例如,createTableIfNotExists返回"TypeError:aztd.createTableIfNotExistis not a function"。源代码如下。

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

我可以看到entityGenerator创建得很好,但我是否缺少TableService的任何内容?

实际上,函数名应该是createTableIfNotExists,而且您似乎键入了一个无效的函数名。

您还可以参考github上azure存储节点的源代码来获取所有函数的信息。