![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
azure-storage-legacy
Advanced tools
Microsoft Azure Storage Client Library for node for back compat with older versions of node sdk
This project provides a Node.js package that lets you consume Azure storage services. This package exists to provide back compatibility with previous versions of the azure sdk for node.
npm install azure-storage-legacy
To ensure a table exists, call createTableIfNotExists:
var tableService = storage.createTableService();
tableService.createTableIfNotExists('tasktable', function(error){
if(!error){
// Table exists
}
});
A new entity can be added by calling insertEntity:
var tableService = storage.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 = storage.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 = storage.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 and it is placed in the same folder as the script below), the method createBlob can be used. This method will return a writable stream which can be writen to, for instance, through piping:
var blobService = storage.createBlobService();
fs.createReadStream('task1-upload.txt').pipe(blobService.createBlob('taskcontainer', 'task1', storage.Constants.BlobConstants.BlobTypes.BLOCK));
To download the blob and write it to the file system, a similar getBlob method can be used:
var blobService = storage.createBlobService();
blobService.getBlob('taskcontainer', 'task1').pipe(fs.createWriteStream('task1-download.txt'));
To create a SAS URL you can use the getBlobUrl method. Additionally you can use the date helper functions to easily create a SAS that expires at some point relative to the current time.
var blobService = storage.createBlobService();
//create a SAS that expires in an hour
var sharedAccessPolicy = {
AccessPolicy: {
Expiry: storage.date.minutesFromNow(60);
}
};
var sasUrl = blobService.getBlobUrl(containerName, blobName, sharedAccessPolicy);
The createQueueIfNotExists method can be used to ensure a queue exists:
var queueService = storage.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 = storage.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 = storage.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].messagetext
queueService.deleteMessage(queueName, serverMessages[0].messageid, serverMessages[0].popreceipt, function(error){
if(!error){
// Message deleted
}
});
}
});
FAQs
Microsoft Azure Storage Client Library for node for back compat with older versions of node sdk
The npm package azure-storage-legacy receives a total of 3,018 weekly downloads. As such, azure-storage-legacy popularity was classified as popular.
We found that azure-storage-legacy 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.