@brighter/storage
Version:
A JavaScript object storage library that enables local development.
27 lines (19 loc) • 358 B
JavaScript
import URL from 'node:url'
const url2parts = url => {
if (!url.startsWith('http://') || !url.startsWith('https://')) {
url = `https://${url}`
}
const parts = URL.parse(url)
let Bucket = parts.hostname
let Key
Key = parts.pathname
Key = Key.substring(1)
return {
Bucket,
Key
}
}
const url = {
url2parts
}
export { url }