Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 Upload CLI

A lightweight command-line tool that uploads local files to any S3-compatible object storage service.

Features

  • Batch upload of arbitrary files to S3-compatible storage (AWS S3, MinIO, OSS, COS, etc.)
  • Preserves original filenames while supporting optional prefixes for organization
  • Path-style URLs for broad S3 compatibility
  • Custom public base URL for friendly links
  • Clear error reporting with non-zero exit codes when uploads fail

Quick Start

1. Requirements

  • Node.js 18 or newer
  • Valid credentials for an S3-compatible object storage account

2. Install dependencies

pnpm install

3. Configure environment variables

  1. Copy the example file and edit it:
    cp .env.example .env
  2. Populate .env with your own values:
    S3_ENDPOINT=s3.example.com
    S3_PORT=443
    S3_USE_SSL=false
    S3_ACCESS_KEY=your-access-key
    S3_SECRET_KEY=your-secret-key
    S3_BUCKET=your-bucket-name
    S3_PREFIX=your-prefix/
    S3_PUBLIC_URL=https://s3.example.com/your-bucket-name
    # ouput: https://s3.example.com/your-bucket-name/your-prefix/filename.png

4. Upload files

node index.js /path/to/file1.png /path/to/file2.pdf

or use the script:

pnpm upload /path/to/file.jpg

Successful uploads print the resulting public URLs. Failed uploads print error messages and set a non-zero exit code so you can integrate the CLI into automated workflows.

About

A lightweight command-line tool that uploads local files to any S3-compatible object storage service.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages