Node.js azure-storage TableService 没有方法
Node.js azure-storage TableService has no methods
我一直在尝试连接到我的 Azure 存储帐户,但我在使用 azure-storage 模块时遇到了一些问题。具体来说,一旦我创建了一个 TableService 对象,该对象就只有一个过滤方法。我尝试过的两种方法是 queryTables 和 createTableIfNotExist。例如,createTableIfNotExistreturns "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');
});
除了找不到函数外,我没有收到任何其他错误。控制台记录 returns 两个变量的函数:
AZSEG Entity,Int32,Int64,Binary,Boolean,String,Guid,Double,DateTime
AZTD filter
我可以看到 entityGenerator 创建良好,但我是否遗漏了 TableService 的任何内容?
实际上,函数名应该是 createTableIfNotExists
,您输入的函数名似乎无效。
也可以参考github上azure-storage-node的源代码来获取所有函数的信息。
我一直在尝试连接到我的 Azure 存储帐户,但我在使用 azure-storage 模块时遇到了一些问题。具体来说,一旦我创建了一个 TableService 对象,该对象就只有一个过滤方法。我尝试过的两种方法是 queryTables 和 createTableIfNotExist。例如,createTableIfNotExistreturns "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');
});
除了找不到函数外,我没有收到任何其他错误。控制台记录 returns 两个变量的函数:
AZSEG Entity,Int32,Int64,Binary,Boolean,String,Guid,Double,DateTime
AZTD filter
我可以看到 entityGenerator 创建良好,但我是否遗漏了 TableService 的任何内容?
实际上,函数名应该是 createTableIfNotExists
,您输入的函数名似乎无效。
也可以参考github上azure-storage-node的源代码来获取所有函数的信息。