npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@babl.one/storage-azure

v0.0.9

Published

Wrapper for Microsoft Azure blob storage

Readme

babl.one Plugin :: /plugins/storage-azure

Overview

This is a plugin for the babl.one framework that provides the app interfaces to store and retrieve files from Microsoft Azure Blob Storage. The plugin allows you to interact with Azure's Blob Storage service to manage files (upload, download, rename, and delete files).

Features

  • Upload files to Azure Blob Storage
  • Download files from Azure Blob Storage to local paths
  • Rename files in Azure Blob Storage
  • Delete files from Azure Blob Storage

Dependencies

  • @azure/storage-blob: Azure SDK for JavaScript to interact with Azure Blob Storage.
  • @babl.one/storage: Interface definitions for working with storage-related tasks in the babl.one framework.
  • fs: Node.js file system module for working with local files.

Class: StorageAzure

The StorageAzure class implements the StorageAPI interface to interact with Azure Blob Storage.

Methods

init()

Initializes the Azure Blob Service client using the provided credentials (account and privateKey).

  • Usage: await storageAzure.init()

read(containerName: string, file: StorageFile)

Downloads a file from the specified container in Azure Blob Storage and writes it to a local path.

  • Parameters:
    • containerName: The name of the container in Azure Blob Storage.
    • file: The file object containing the remote path and local path for the file.
  • Returns: A promise that resolves with the updated file object.
  • Usage: await storageAzure.read('myContainer', file)

write(containerName: string, file: StorageFile)

Uploads a file to Azure Blob Storage from a local file or a buffer.

  • Parameters:
    • containerName: The name of the container in Azure Blob Storage.
    • file: The file object containing the local path and blob data.
  • Returns: A promise that resolves with the updated file object.
  • Usage: await storageAzure.write('myContainer', file)

delete(containerName: string, file: StorageFile)

Deletes a file from Azure Blob Storage.

  • Parameters:
    • containerName: The name of the container in Azure Blob Storage.
    • file: The file object containing the remote path for the file to be deleted.
  • Returns: A promise that resolves with the updated file object.
  • Usage: await storageAzure.delete('myContainer', file)

rename(containerName: string, file: StorageFile)

Renames (or moves) a file in Azure Blob Storage by copying it to a new location and deleting the old file.

  • Parameters:
    • containerName: The name of the container in Azure Blob Storage.
    • file: The file object containing the remote paths for the old and new file locations.
  • Returns: A promise that resolves with the updated file object.
  • Usage: await storageAzure.rename('myContainer', file)

Usage Example

const storageAzure = new StorageAzure(config);

// Initialize the Azure Blob client
await storageAzure.init();

// Define the file object for the operation
const file = {
  remotePath: 'path/to/remote/file',
  localPath: '/path/to/local/file',
  blob: null,  // The file's data (for write operations)
  status: 'PENDING',
};

// Read a file from Azure Blob Storage to local path
await storageAzure.read('myContainer', file);

// Upload a file to Azure Blob Storage
await storageAzure.write('myContainer', file);

// Delete a file from Azure Blob Storage
await storageAzure.delete('myContainer', file);

// Rename a file in Azure Blob Storage
await storageAzure.rename('myContainer', file);

Notes

  • Ensure that the Azure credentials (account and privateKey) are provided in the configuration.
  • This plugin uses streams to download files from Azure Blob Storage, so it works efficiently even with large files.