@dstanesc/az-block-store
v0.0.5
Published
Simple content-addressable storage (CAS) based on Azure Blob Storage
Downloads
2
Readme
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.