@momocode/parse-s3-uri
Parse s3://bucket/key style uri
Last updated 10 months ago by simomo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @momocode/parse-s3-uri 
SYNC missed versions from official npm registry.

parse-s3-uri

parse-s3-uri is a very simple function to parse uris of form

s3://bucket/key

and optionally to interpret whether a "directory" is intended if key ends with a slash e.g

s3://bucket/dir/

Usage

const parseS3Uri = require('@momocode/parse-s3-uri')
parseS3Uri('s3://bucket/key')
// { bucket: 'bucket', key: 'key' }
parseS3Uri('s3://bucket/no-slash', {interpretDirectory: true})
// { bucket: 'bucket', key: 'no-slash', isDirectory: false }
parseS3Uri('s3://bucket/dir/', {interpretDirectory: true})
// { bucket: 'bucket', key: 'dir', isDirectory: true }

Note that only uris of form s3://bucket/key are parsed i.e anything else including actual s3 https urls such as https://s3.amazonaws.com/bucket/key will not work.

If anything but a string is given as parameter, a TypeError is thrown. If the uri is not of the expected form, a parseS3Uri.S3UriError is thrown.

Current Tags

  • 0.0.2                                ...           latest (10 months ago)

2 Versions

  • 0.0.2                                ...           10 months ago
  • 0.0.1                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |