@dstanesc/az-block-store
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Azure Block Store

Simple content-addressable storage (CAS) based on Azure Blob Storage.

API

put: (block: { cid: any, bytes: Uint8Array }) => Promise<void>
get: (cid: any) => Promise<Uint8Array>

Usage

  // connect to Azure, see more @ https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs 
  const accountName = ...
  const blobServiceClient: BlobServiceClient = new BlobServiceClient(
    `https://${accountName}.blob.core.windows.net`,
    new DefaultAzureCredential()
  )
  const randomContainerName = ...
  containerClient: ContainerClient = blobServiceClient.getContainerClient(randomContainerName)
  await containerClient.create()

  // optional cache
  const cache = {}

  // az-block-store api
  const { get, put } = blockStore({ /*cache,*/ containerClient })

Build

npm run clean
npm install
npm run build

Test

Configure your storage account

export AZURE_STORAGE_ACCOUNT_NAME=xyz
npm run test

Licenses

Licensed under either Apache 2.0 or MIT at your option.

Readme

Keywords

none

Package Sidebar

Install

npm i @dstanesc/az-block-store

Weekly Downloads

1

Version

0.0.5

License

(Apache-2.0 AND MIT)

Unpacked Size

26.3 kB

Total Files

23

Last publish

Collaborators

  • dstanesc