url-encode-base64
v1.0.0
Published
Better than "encodeURIComponent" to reduce character overhead
Downloads
26
Maintainers
Readme
url-encode-base64
Introduction
Better than "encodeURIComponent" to reduce character overhead.
Getting Started
Install
Browser:
<script src="dist/url-encode-base64.umd.min.js"></script>
| | | | ---------- | -----------| | unpkg | https://unpkg.com/url-encode-base64/ | | jsDelivr | https://jsdelivr.com/package/npm/url-encode-base64 |
With npm:
$ npm i url-encode-base64 --save
Usage
Commonjs
const { urlEncode, urlDecode } = require('url-encode-base64');
const encoded = urlEncode('💩💩💩');
console.log(encoded, encoded.length); // '8J_SqfCfkqnwn5Kp' 16
console.log(urlDecode(encoded)); // '💩💩💩'
const encoded2 = encodeURIComponent('💩💩💩');
console.log(encoded2, encoded2.length); // '%F0%9F%92%A9%F0%9F%92%A9%F0%9F%92%A9' 36
ES Module
import { urlEncode, urlDecode } from 'url-encode-base64';
UMD
<script src="dist/url-encode-base64.umd.min.js"></script>
<script type="text/javascript">
const { urlEncode, urlDecode } = urlEncodeBase64;
</script>