
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
This project provides a set of Node.js packages that make it easy to access the Windows Azure storage and queue services. For documentation on how to host Node.js applications on Windows Azure, please see the Windows Azure Node.js Developer Center.
To get the source code of the SDK via git just type:
git clone https://github.com/WindowsAzure/azure-sdk-for-node.git
cd ./azure-sdk-for-node
Alternatively, to get the source code via the Node Package Manager (npm), type
npm install azure
You can use these packages against the cloud Windows Azure Services, or against the local Storage Emulator.
To ensure a table exists, call createTableIfNotExists:
var tableService = azure.createTableService(); tableService.createTableIfNotExists('tasktable', function(error){ if(!error){ // Table exists } });
A new entity can be added by calling insertEntity:
var tableService = azure.createTableService(), task1 = { PartitionKey : 'tasksSeattle', RowKey: '1', Description: 'Take out the trash', DueDate: new Date(2011, 12, 14, 12) }; tableService.insertEntity('tasktable', task1, function(error){ if(!error){ // Entity inserted } });
The method queryEntity can then be used to fetch the entity that was just inserted:
var tableService = azure.createTableService(); tableService.queryEntity('tasktable', 'tasksSeattle', '1', function(error, serverEntity){ if(!error){ // Entity available in serverEntity variable } });
The createContainerIfNotExists method can be used to create a container in which to store a blob:
var blobService = azure.createBlobService(); blobService.createContainerIfNotExists('taskcontainer', {publicAccessLevel : 'blob'}, function(error){ if(!error){ // Container exists and is public } });
To upload a file (assuming it is called task1-upload.txt, it contains the exact text "hello world" (no quotation marks), and it is placed in the same folder as the script below), the method createBlockBlobFromStream can be used:
var blobService = azure.createBlobService(); blobService.createBlockBlobFromStream('taskcontainer', 'task1', fs.createReadStream('task1-upload.txt'), 11, function(error){ if(!error){ // Blob uploaded } });
To download the blob and write it to the file system, the getBlobToStream method can be used:
var blobService = azure.createBlobService(); blobService.getBlobToStream('taskcontainer', 'task1', fs.createWriteStream('task1-download.txt'), function(error, serverBlob){ if(!error){ // Blob available in serverBlob.blob variable } });
The createQueueIfNotExists method can be used to ensure a queue exists:
var queueService = azure.createQueueService(); queueService.createQueueIfNotExists('taskqueue', function(error){ if(!error){ // Queue exists } });
The createMessage method can then be called to insert the message into the queue:
var queueService = azure.createQueueService(); queueService.createMessage('taskqueue', "Hello world!", function(error){ if(!error){ // Message inserted } });
It is then possible to call the getMessage method, process the message and then call deleteMessage inside the callback. This two-step process ensures messages don't get lost when they are removed from the queue.
var queueService = azure.createQueueService(), queueName = 'taskqueue'; queueService.getMessages(queueName, function(error, serverMessages){ if(!error){ // Process the message in less than 30 seconds, the message // text is available in serverMessages[0].messagetextqueueService.deleteMessage(queueName, serverMessages[0].messageid, serverMessages[0].popreceipt, function(error){ if(!error){ // Message deleted } }); }
});
For more examples please see the Windows Azure Node.js Developer Center.
Be sure to check out the Windows Azure Developer Forums on Stack Overflow if you have trouble with the provided code.
For feedback related specifically to this SDK, please use the Issues section of the repository.
For general suggestions about Windows Azure please use our UserVoice forum.
2011.12.14 Version 0.5.1
FAQs
Microsoft Azure Client Library for node
The npm package azure receives a total of 9,531 weekly downloads. As such, azure popularity was classified as popular.
We found that azure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.