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

@ionq/storage-client

v1.2.0

Published

A vendor-agnostic storage client for GCS, S3, and Signed URLs

Readme

Multi-Cloud Storage Client

This library provides a unified interface for interacting with different cloud storage providers, such as Google Cloud Storage (GCS) and Amazon S3.

OpenTelemetry Tracing

This library is instrumented with OpenTelemetry. If the application using this library has an active OpenTelemetry SDK configured, a trace span will be created automatically when a GCSStorageProvider is instantiated.

You can also add custom attributes to this span by passing a tracingAttributes object to the factory function.

Usage

createStorageProvider(type, options, tracingAttributes)

The createStorageProvider factory function is the primary way to create a storage provider instance.

  • type: The type of storage provider to create. Use the StorageProviderType enum (GCS or S3).
  • options: The configuration options for the specific provider. These are passed directly to the underlying SDK.
  • tracingAttributes (optional): A map of key-value pairs to be added as attributes to the client constructor trace span.

IStorageProvider

All storage providers implement the IStorageProvider interface, which defines the following methods:

  • get(bucket: string, path: string): Promise<Buffer>
  • getStream(bucket: string, path: string): Readable
  • put(bucket: string, path: string, content: Buffer | string): Promise<void>
  • putStream(bucket: string, path: string): Writable
  • delete(bucket: string, path: string): Promise<void>
  • list(bucket: string, prefix?: string): Promise<string[]>

Example

Google Cloud Storage (GCS) with Tracing Attributes

import {
    createStorageProvider,
    StorageProviderType,
    StorageOptions,
} from '@ionq/storage-client';

const gcsOptions: StorageOptions = {
    projectId: 'your-gcp-project-id',
    keyFilename: '/path/to/your/keyfile.json',
};

// Add custom attributes to the constructor's trace span.
const tracingAttributes = {
    'region': 'ionq-us-east1',
    'app.service.name': 'my-data-processor',
};

const gcsProvider = createStorageProvider(
    StorageProviderType.GCS,
    gcsOptions,
    tracingAttributes,
);

async function runGCSExample() {
    const bucket = 'my-gcs-bucket';
    const path = 'my-file.txt';
    const content = 'Hello, GCS!';

    await gcsProvider.put(bucket, path, content);
    console.log('File uploaded to GCS.');

    const fileContent = await gcsProvider.get(bucket, path);
    console.log('File content from GCS:', fileContent.toString());
}

runGCSExample();

Amazon S3

import {
    createStorageProvider,
    StorageProviderType,
    S3ClientConfig,
} from '@ionq/storage-client';

const s3Options: S3ClientConfig = {
    region: 'us-east-1',
    credentials: {
        accessKeyId: 'YOUR_AWS_ACCESS_KEY_ID',
        secretAccessKey: 'YOUR_AWS_SECRET_ACCESS_KEY',
    },
};

const s3Provider = createStorageProvider(StorageProviderType.S3, s3Options);

async function runS3Example() {
    const bucket = 'my-s3-bucket';
    const path = 'my-file.txt';
    const content = 'Hello, S3!';

    await s3Provider.put(bucket, path, content);
    console.log('File uploaded to S3.');

    const fileContent = await s3Provider.get(bucket, path);
    console.log('File content from S3:', fileContent.toString());
}

runS3Example();