Back

Blog details

AIOZ Storage JavaScript SDK Quickstart with client-s3

AIOZ Network
5 min readAugust 10, 2026
aioz-storage
AIOZ Storage JavaScript SDK Quickstart

There's no dedicated AIOZ Storage JavaScript package to install. The AIOZ storage javascript sdk is the standard AWS SDK for JavaScript v3, @aws-sdk/client-s3, pointed at a different endpoint with one extra config flag. This quickstart covers the exact client setup AIOZ's own SDK documentation specifies, then uploading, listing, and downloading objects with it.

TL;DR:

  • Install @aws-sdk/client-s3, the same package used against Amazon S3 itself, no AIOZ-specific package exists or is needed.
  • AIOZ's own SDK docs specify region: 'us-east-1', a custom endpoint, and forcePathStyle: true as the required client config.
  • forcePathStyle is not optional boilerplate, without it the SDK tries virtual-hosted-style URLs that don't resolve against AIOZ Storage's single endpoint.

Is There a Dedicated AIOZ Storage JavaScript SDK?

No, and that's by design, not a gap. AIOZ Storage's S3-compatible API works directly with @aws-sdk/client-s3, the same official AWS SDK package used against Amazon S3. Install it with npm install @aws-sdk/client-s3, there's nothing AIOZ-specific to add on top.

Configuring the S3Client for AIOZ Storage

AIOZ's own SDK documentation specifies this exact configuration:

import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3'

const s3Client = new S3Client({
  region: 'us-east-1',
  credentials: {
    accessKeyId: 'YOUR_ACCESS_KEY_ID',
    secretAccessKey: 'YOUR_SECRET_ACCESS_KEY'
  },
  endpoint: {
    url: 'https://s3.aiozstorage.network'
  },
  forcePathStyle: true
})

Two settings matter more than the others here. region: 'us-east-1' is required by the SDK's constructor even though AIOZ Storage isn't region-partitioned, the same placeholder-region pattern AIOZ's Python SDK docs use too. And forcePathStyle: true isn't optional: without it, the SDK defaults to virtual-hosted-style requests (bucket.endpoint/key), which don't resolve against AIOZ Storage's single endpoint the way they do against AWS's per-region S3 endpoints. Leave it out and every request fails before it gets anywhere near your bucket.

Three people looking at and pointing to a laptop screen together

Uploading an Object

async function uploadFile(bucket, key, body) {
  const command = new PutObjectCommand({
    Bucket: bucket,
    Key: key,
    Body: body,
  })
  return s3Client.send(command)
}

await uploadFile('your-bucket', 'hello.txt', 'Hello from AIOZ Storage')

Every operation in the v3 SDK follows this same command-object pattern: build a Command with the parameters, pass it to s3Client.send(). Body accepts a string, a Buffer, or a readable stream, whatever shape your data is already in, without needing to convert it first.

Listing and Downloading Objects

import { ListObjectsV2Command, GetObjectCommand } from '@aws-sdk/client-s3'

async function listFiles(bucket) {
  const command = new ListObjectsV2Command({ Bucket: bucket })
  const response = await s3Client.send(command)
  return (response.Contents || []).map(obj => obj.Key)
}

async function downloadFile(bucket, key) {
  const command = new GetObjectCommand({ Bucket: bucket, Key: key })
  const response = await s3Client.send(command)
  return response.Body.transformToString()
}

response.Body in the v3 SDK is a web stream, not a plain string, which is why downloadFile calls .transformToString() on it. If you're downloading binary data instead of text, transformToByteArray() does the same job for a Uint8Array instead.

Deleting an Object

import { DeleteObjectCommand } from '@aws-sdk/client-s3'

async function deleteFile(bucket, key) {
  const command = new DeleteObjectCommand({ Bucket: bucket, Key: key })
  return s3Client.send(command)
}

Same pattern as every other operation: build the command, send it. Like the S3 API generally, a delete against a key that doesn't exist still resolves successfully rather than throwing, so this won't tell you whether the file was actually there before you deleted it.

Laptop screen showing colorful syntax-highlighted code in a dark editor

Handling Errors

Every s3Client.send() call can reject, a missing bucket, an expired credential, a network failure, and the v3 SDK throws a typed ServiceException you can catch and inspect:

import { S3ServiceException } from '@aws-sdk/client-s3'

try {
  await s3Client.send(command)
} catch (error) {
  if (error instanceof S3ServiceException) {
    console.error(`S3 error: ${error.name} - ${error.message}`)
  } else {
    throw error
  }
}

error.name gives you the specific error code (NoSuchKey, NoSuchBucket, AccessDenied, and so on), the same information boto3 surfaces through its own exception classes on the Python side of this SDK family.

Frequently Asked Questions

What npm package do I need for the AIOZ Storage JavaScript SDK?
@aws-sdk/client-s3, the standard AWS SDK for JavaScript v3. No separate AIOZ-specific package exists.

Why does the S3Client need forcePathStyle: true for AIOZ Storage?
Without it, the SDK defaults to virtual-hosted-style request URLs (bucket.endpoint/key), which don't work against AIOZ Storage's single endpoint. forcePathStyle switches requests to endpoint/bucket/key instead.

Why does the client need a region if AIOZ Storage isn't region-partitioned?
The SDK's constructor requires a region value regardless of target. AIOZ's own documentation sets it to us-east-1 as a placeholder.

What does response.Body look like when downloading with the v3 SDK?
A web stream, not a plain string or Buffer. Call .transformToString() for text or .transformToByteArray() for binary data.

Does uploading with PutObjectCommand accept a file stream, or only a string?
Both, and a Buffer too. Body accepts whatever shape your data is already in without requiring a conversion step first.

How do I catch and identify S3 errors in the JavaScript SDK?
Catch S3ServiceException, the SDK's base error class for service errors, and check error.name for the specific error code (NoSuchKey, NoSuchBucket, AccessDenied, and similar).

Does deleting a nonexistent key throw an error?
No. Like the S3 API generally, DeleteObjectCommand resolves successfully even if the key was never there, so it won't tell you whether anything was actually deleted.

Is the JavaScript SDK setup different from the Python (boto3) setup?
Same underlying pattern, different syntax: both need a custom endpoint pointed at AIOZ Storage and a path-style addressing flag (forcePathStyle in JS, addressing_style: path in boto3's Config).

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

How Automatic MIME Type Detection Works on AIOZ Storage

Automatic MIME type detection on AIOZ Storage uses Google Magika to identify a file's type from its content when Content-Type is missing. How it actually works.

aioz-storage
5 min readSeptember 07, 2026
blog thumbnail

AIOZ Storage Developer Platform: SDKs, CLI, and Migrations

The AIOZ storage developer platform in one place: three SDKs, a CLI, direct API access, two migration paths, and the one config pattern tying it all together.

aioz-storage
6 min readSeptember 06, 2026
blog thumbnail

The 3-2-1 Backup Rule: A Practical Framework Explained

The 3-2-1 backup rule: three copies, two media, one off-site. Why it still holds up, why ransomware forced a 3-2-1-1-0 update, and where AIOZ Storage fits.

aioz-storage
8 min readSeptember 05, 2026
blog thumbnail

RBAC vs ABAC vs Capability-Based Access Control Explained

RBAC vs ABAC vs capability-based access control: three different answers to who can do what. NIST defines the first two, AIOZ Storage macaroons are the third.

aioz-storage
8 min readSeptember 04, 2026
blog thumbnail

What Is a CDN and How Does It Relate to Object Storage?

What is a CDN: a network of cached servers placed near users to cut latency. How it sits in front of an origin like S3, and where AIOZ Storage fits in.

aioz-storage
7 min readSeptember 03, 2026
blog thumbnail

Hot vs Cold Storage: Storage Tiers and When They Matter

Hot vs cold storage: hot tiers cost more to store but less to access, cold tiers flip that trade. How AWS and Azure structure it, and where AIOZ Storage fits.

aioz-storage
8 min readSeptember 02, 2026