How do I get a list of tables from Azure Table Storage using Node.js?

Viewed 338

I am using azure-storage-node package in a node.js module. I can create tables and entities but I cannot see how to get a list of tables from the storage container. How do I do this?

1 Answers

You would need to call listTablesSegmented method to list the tables.

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
    }
  }
});
Related