A lightweight command-line tool that uploads local files to any S3-compatible object storage service.
- 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
- Node.js 18 or newer
- Valid credentials for an S3-compatible object storage account
pnpm install- Copy the example file and edit it:
cp .env.example .env
- Populate
.envwith 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
node index.js /path/to/file1.png /path/to/file2.pdfor use the script:
pnpm upload /path/to/file.jpgSuccessful 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.