Socket
Socket
Sign inDemoInstall

azure-storage

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-storage

Microsoft Azure Storage Client Library for Node.js


Version published
Weekly downloads
169K
decreased by-0.46%
Maintainers
2
Weekly downloads
 
Created

What is azure-storage?

The azure-storage npm package is a client library for working with Azure Storage services, including Blob, File, Queue, and Table storage. It allows developers to interact with these services programmatically, enabling tasks such as uploading and downloading files, managing queues, and working with table data.

What are azure-storage's main functionalities?

Blob Storage

Blob Storage allows you to store large amounts of unstructured data, such as text or binary data. The code sample demonstrates how to upload a text file to a blob container.

const azure = require('azure-storage');
const blobService = azure.createBlobService();

// Upload a text file to a container
blobService.createBlockBlobFromText('mycontainer', 'myblob', 'Hello, World!', function(error, result, response) {
  if (!error) {
    console.log('Blob uploaded successfully');
  }
});

File Storage

File Storage provides a way to store and access files in the cloud. The code sample shows how to create a file share and upload a text file to it.

const azure = require('azure-storage');
const fileService = azure.createFileService();

// Create a share and upload a file
fileService.createShareIfNotExists('myshare', function(error, result, response) {
  if (!error) {
    fileService.createFileFromText('myshare', '', 'myfile', 'Hello, World!', function(error, result, response) {
      if (!error) {
        console.log('File uploaded successfully');
      }
    });
  }
});

Queue Storage

Queue Storage provides reliable messaging for workflow processing and communication between different parts of your application. The code sample demonstrates how to create a queue and add a message to it.

const azure = require('azure-storage');
const queueService = azure.createQueueService();

// Create a queue and add a message
queueService.createQueueIfNotExists('myqueue', function(error, result, response) {
  if (!error) {
    queueService.createMessage('myqueue', 'Hello, World!', function(error, result, response) {
      if (!error) {
        console.log('Message added to queue');
      }
    });
  }
});

Table Storage

Table Storage offers a NoSQL key-value store for rapid development using massive semi-structured datasets. The code sample shows how to create a table and insert an entity into it.

const azure = require('azure-storage');
const tableService = azure.createTableService();

// Create a table and insert an entity
const entGen = azure.TableUtilities.entityGenerator;
const task = {
  PartitionKey: entGen.String('tasks'),
  RowKey: entGen.String('1'),
  description: entGen.String('Task 1'),
  dueDate: entGen.DateTime(new Date(Date.UTC(2023, 10, 1)))
};

tableService.createTableIfNotExists('mytable', function(error, result, response) {
  if (!error) {
    tableService.insertEntity('mytable', task, function(error, result, response) {
      if (!error) {
        console.log('Entity inserted');
      }
    });
  }
});

Other packages similar to azure-storage

Keywords

FAQs

Package last updated on 04 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc