Skip to content

@venturekit/storage API

The storage client provides a full-featured S3-compatible API that works with both AWS S3 (production) and MinIO (local dev). It auto-detects the environment.

Create a storage client with explicit configuration.

import { createStorageClient } from '@venturekit/storage';
const storage = createStorageClient({
bucket: 'my-uploads',
prefix: 'tenant-123/', // optional key prefix
});

Config options:

OptionTypeDescription
bucketstringS3 bucket name (required)
regionstringAWS region (default: AWS_REGION env var)
endpointstringCustom S3 endpoint (auto-set for MinIO locally)
forcePathStylebooleanForce path-style URLs (auto-set for MinIO)
prefixstringKey prefix for all operations
credentialsobjectAWS credentials (uses default chain if omitted)

Create a storage client from environment variables. Reads VENTURE_STORAGE_BUCKET, VENTURE_STORAGE_PREFIX, and MinIO config from env.

import { createStorageClientFromEnv } from '@venturekit/storage';
const storage = createStorageClientFromEnv();
MethodDescription
put(key, body, options?)Upload data (Buffer, string, or stream)
get(key, options?)Download data as Buffer
getStream(key, options?)Download data as readable stream
head(key)Get object metadata without downloading
delete(key)Delete an object
deleteMany(keys)Delete multiple objects
copy(src, dest, options?)Copy an object
move(src, dest, options?)Move an object (copy + delete)
list(options?)List objects (paginated)
listAll(options?)List all objects (auto-paginate)
exists(key)Check if an object exists
getSignedUrl(key, options?)Get a signed download URL
getSignedUploadUrl(key, options?)Get a signed upload URL
upload(key, body, options?)Multipart upload for large files
OptionTypeDescription
contentTypestringMIME content type
cacheControlstringCache control header
metadataRecord<string, string>Custom metadata
storageClassstringStorage class (STANDARD, GLACIER, etc.)
encryption'AES256' | 'aws:kms'Server-side encryption
tagsRecord<string, string>Object tags
OptionTypeDescription
expiresInnumberExpiration in seconds (default: 3600)
responseContentTypestringOverride response content type
responseContentDispositionstringOverride content disposition
FunctionDescription
createS3Config(options)Create S3 bucket configuration
buildS3Config(config)Build S3 infrastructure config
ConstantDescription
DEFAULT_S3_CONFIGDefault S3 configuration
TypeDescription
StorageClientThe storage client interface
StorageClientConfigClient configuration
PutOptionsUpload options
GetResultDownload result (body + metadata)
GetStreamResultStream download result
HeadResultMetadata-only result
ListResultList result with pagination
ObjectInfoObject metadata in list results
SignedUrlOptionsSigned download URL options
SignedUploadUrlOptionsSigned upload URL options
S3OutputsS3 deployment outputs
S3InfraConfigS3 infrastructure configuration