Wondering what’s next for npm?Check out our public roadmap! »

amazon-s3-uri
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

AmazonS3URI

Actions Status

A URI wrapper that can parse out information about an S3 URI

Shamelessly adapted from https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3URI.java

with notable exceptions:

  • it doesn't parse version
  • There is no preprocessing on given url string (you have to encode and replace special characters yourself if needed)
  • For a valid S3 uri, region is never null but will default to us-east-1

example

const AmazonS3URI = require('amazon-s3-uri')
 
try {
  const uri = 'https://bucket.s3-aws-region.amazonaws.com/key'
  const { region, bucket, key } = AmazonS3URI(uri)
} catch (err) {
  console.warn(`${uri} is not a valid S3 uri`) // should not happen because `uri` is valid in that example
}

license

MIT

Install

npm i amazon-s3-uri

DownloadsWeekly Downloads

16,740

Version

0.1.0

License

MIT

Unpacked Size

13.3 kB

Total Files

10

Last publish

Collaborators

  • avatar