如何使用Node.js从Azure表存储中获取表列表?

问题描述 投票:0回答:1

我在node.js模块中使用azure-storage-node包。我可以创建表和实体,但我看不到如何从存储容器中获取表的列表。我该怎么做呢?

node.js azure azure-table-storage
1个回答
1
投票

您需要调用listTablesSegmented方法来列出表。

var azure = require('azure-storage');
var tableSvc = azure.createTableService('account-name', 'account-key');

tableSvc.listTablesSegmented(null, function(error, result) {
  if (!error) {
    var entries = result.entries;
    for (var i=0; i<entries.length; i++) {
      console.log(entries[i]);//prints table name
    }
  }
});
© www.soinside.com 2019 - 2024. All rights reserved.