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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@venturialstd/backblaze

v0.0.2

Published

Backblaze B2 S3-Compatible API client for Venturial (no AWS SDK)

Downloads

165

Readme

@venturialstd/backblaze

Backblaze B2 client using the S3-Compatible API (no AWS SDK). Authentication via AWS Signature Version 4 using the aws4 library. Intended for use across multiple projects that need Backblaze storage.

Features

  • Authentication: AWS Sig v4 (Application Key = access key + secret).
  • Buckets: List Buckets (GET /), Create Bucket (PUT /bucket-name), Delete Bucket (DELETE /bucket-name), Head Bucket (HEAD /bucket-name).
  • Objects: Put Object, Get Object, Delete Object, List Objects V2, Head Object.
  • Credentials from SettingsModule or per-request via BackblazeOptions (includes region).
  • S3 XML responses parsed to JSON (ListBuckets, ListObjectsV2).

Requirements

  • Backblaze B2 Application Key (S3-compatible).
  • Configure in settings: GLOBAL:BACKBLAZE:GENERAL:REGION, GLOBAL:BACKBLAZE:GENERAL:ACCESS_KEY_ID, GLOBAL:BACKBLAZE:GENERAL:SECRET_ACCESS_KEY.

Installation

npm install @venturialstd/backblaze
yarn add @venturialstd/backblaze

Basic usage

All bucket and object methods accept DTOs (e.g. CreateBucketDto, PutObjectDto, ListObjectsDto). When the API returns an error (4xx/5xx), the client throws BackblazeS3Error with the Backblaze/S3 Code, Message, and statusCode so the error message is visible to callers.

import {
  BackblazeModule,
  BackblazeBucketService,
  BackblazeObjectService,
  CreateBucketDto,
  PutObjectDto,
  ListObjectsDto,
  BucketAcl,
  ContentType,
} from '@venturialstd/backblaze';

@Module({
  imports: [BackblazeModule],
})
export class AppModule {}

@Injectable()
export class MyService {
  constructor(
    private readonly bucketService: BackblazeBucketService,
    private readonly objectService: BackblazeObjectService,
  ) {}

  async listBuckets() {
    const { buckets } = await this.bucketService.listBuckets();
    return buckets;
  }

  async createBucket(dto: CreateBucketDto) {
    await this.bucketService.createBucket(
      { ...dto, acl: dto.acl ?? BucketAcl.Private },
    );
  }

  async upload(bucketName: string, key: string, body: Buffer) {
    await this.objectService.putObject({
      bucketName,
      key,
      body,
      contentType: ContentType.ApplicationJson,
    });
  }

  async download(bucketName: string, key: string) {
    return this.objectService.getObject({ bucketName, key });
  }

  async listObjects(bucketName: string, prefix?: string) {
    return this.objectService.listObjectsV2({
      bucketName,
      prefix,
      maxKeys: 1000,
    });
  }
}

Error handling

On 4xx/5xx the client throws BackblazeS3Error with the parsed S3 Code, Message, and statusCode. Use it for programmatic handling:

import { BackblazeS3Error, BackblazeS3ErrorCode } from '@venturialstd/backblaze';

try {
  await this.objectService.getObject({ bucketName: 'b', key: 'k' });
} catch (err) {
  if (err instanceof BackblazeS3Error) {
    console.error(err.message); // Backblaze/S3 error message
    if (err.isNotFound) { /* ... */ }
    if (err.isAccessDenied) { /* ... */ }
  }
  throw err;
}

Per-request options

await this.bucketService.listBuckets({
  region: 'us-west-004',
  credentials: { accessKeyId: '...', secretAccessKey: '...' },
});

S3-Compatible API (official documentation)

  • List Buckets: GET https://s3.<region>.backblazeb2.com/
  • Create Bucket: PUT https://s3.<region>.backblazeb2.com/<bucket-name> (optional: CreateBucketConfiguration XML body, header x-amz-acl: private | public-read)
  • Delete Bucket: DELETE https://s3.<region>.backblazeb2.com/<bucket-name>
  • Head Bucket: HEAD https://s3.<region>.backblazeb2.com/<bucket-name>
  • Put Object: PUT https://s3.<region>.backblazeb2.com/<bucket>/<key> (body = file)
  • Get Object: GET https://s3.<region>.backblazeb2.com/<bucket>/<key>
  • Delete Object: DELETE https://s3.<region>.backblazeb2.com/<bucket>/<key>
  • List Objects V2: GET https://s3.<region>.backblazeb2.com/<bucket>?list-type=2&prefix=...&max-keys=...
  • Head Object: HEAD https://s3.<region>.backblazeb2.com/<bucket>/<key>

Notes

  • The AWS SDK is not used; requests are signed with aws4 and sent with HttpService.
  • Backblaze only supports "private" and "public-read" ACLs at bucket level.
  • DTOs: All operations use DTOs (CreateBucketDto, DeleteBucketDto, HeadBucketDto, PutObjectDto, GetObjectDto, DeleteObjectDto, HeadObjectDto, ListObjectsDto). Enums: BucketAcl, ContentType, BackblazeRegion. Normalized results: listBuckets(), listObjectsV2(). Raw: listBucketsRaw(), listObjectsV2Raw().
  • Errors: On API errors the client throws BackblazeS3Error with the Backblaze/S3 message and code so the error is visible (e.g. in exception filters). Use BackblazeS3ErrorCode for known codes.
  • Developed and maintained by Venturial.

License

MIT