UNPKG

s3encode

Version:

Encode url symbols to be s3 compatible

24 lines (23 loc) 519 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var encodings = { '\+': "%2B", '\!': "%21", '\"': "%22", '\#': "%23", '\$': "%24", '\&': "%26", '\'': "%27", '\(': "%28", '\)': "%29", '\*': "%2A", '\,': "%2C", '\:': "%3A", '\;': "%3B", '\=': "%3D", '\?': "%3F", '\@': "%40", }; exports.default = (function (filename) { return filename.replace(/([+!"#$&'()*+,:;=?@])/img, function (match) { return encodings[match]; }); });