A small, dependency-free TypeScript library for formatting and parsing Amazon S3 URLs (v1.0.3). It supports virtual-hosted-style and path-style URLs, regional and legacy endpoints, and both s3:// and https:// protocols. The library provides types for S3 objects and URL formats, and exports functions formatS3Url, parseS3Url, and isS3Url. It does not validate bucket names or object keys against AWS rules, nor does it support S3 access points or Object Lambda. Commonly used in AWS SDK workflows for generating S3 URIs.
npm install amazon-s3-urlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows formatting of S3 URLs in various styles, parsing a URL back to an object, and validation with isS3Url.
Validate bucket names and keys against AWS naming rules separately before calling formatS3Url.
Use virtual-hosted-style URLs (e.g., https://bucket.s3.amazonaws.com/key) for new integrations.
Use regional endpoints (s3.<region>.amazonaws.com) for consistent support.
Use https-based formats (e.g., 'https-region-virtual-host') if you need an HTTPS URL for HTTP clients.
Always check parsed.bucket and parsed.key for truthiness before use.
Use named import: import { formatS3Url } from 'amazon-s3-url'Run npm install amazon-s3-url and ensure import path is correct.
Declare region as optional in your type or use conditional checks.
Use import syntax instead: import { formatS3Url } from 'amazon-s3-url'No dependency data recorded yet.