Socket
Socket
Sign inDemoInstall

@vtfk/azure-storage-blob

Package Overview
Dependencies
22
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vtfk/azure-storage-blob

High-level API for Azure Blob Storage operations


Version published
Weekly downloads
6
Maintainers
3
Created
Weekly downloads
 

Readme

Source

(WIP) azure-blob-storage

High-level API for Azure Blob Storage operations.

Uses the @azure/storage-blob SDK

Install

npm i --save @vtfk/azure-storage-blob

API

Connection

Currently it only supports Shared Access Signature (SAS)

Go to https://portal.azure.com

Storage accounts -> Your Storage account -> Shared access signature

Generate a SAS with desired start and end time.

Copy and use Blob service SAS URL as connectionString

const storage = require('@vtfk/azure-blob-storage')({
  connectionString: '<BLOB_SERVICE_SAS_URL>'
  /* optional timeout in ms
    timeout: 30 * 1000
  */
})

Container operations

List containers in storage account

const { containerItems } = await storage.list()

Create a container

await storage.create('containername')

Remove a container

await storage.remove('containername')

Blob operations

First, connect to a desired container

const container = storage.container('containername')

List blobs in container

const { segment: { blobItems } } = await container.list()

Write text to blob

await container.writeText('test.json', JSON.stringify({ text: 'One thought fills immensity.' }))

Read blob

const content = await container.read('test.json')

Remove blob

await container.remove('test.json')

Examples

See examples/example.js

To run example.js create file .env in project root with following content

BLOB_SERVICE_SAS_URL=<BLOB_SERVICE_SAS_URL>

And run npm run example

License

MIT

Keywords

FAQs

Last updated on 29 Mar 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc