https://github.com/tradle/urlsafe-base64
This library de-/encodes urlsafe base64 strings.
https://github.com/tradle/urlsafe-base64
base64 urlsafe urlsafe-base64
Last synced: 8 months ago
JSON representation
This library de-/encodes urlsafe base64 strings.
- Host: GitHub
- URL: https://github.com/tradle/urlsafe-base64
- Owner: tradle
- License: mit
- Created: 2022-01-25T16:10:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-29T16:21:25.000Z (about 4 years ago)
- Last Synced: 2025-01-17T00:53:04.423Z (over 1 year ago)
- Topics: base64, urlsafe, urlsafe-base64
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# python compatible urlsafe base 64 codec
Similar to [urlsafe-base64](https://npmjs.com/package/urlsafe-base64) this library de-/encodes urlsafe base64 strings.
What it does different:
- Offers a `safe` and `short` variant with the `short` variant being same as `urlsafe-base64` and the `safe` variant keeping
the ending `=` characters making it compatible with other implementations such as python.
- Comes with typescript definitions.
- Uses `Buffer.from` as `new Buffer` has been deprecated for a long time.
## Usage
```js
import { short, safe } from '@tradle/urlsafe-base64'
;[ short, safe ].forEach(variant => {
const base64Str = short.encode('hello')
const decoded = short.decode(base64Str)
const original = decoded.toString()
})
```
## License
[MIT](./LICENSE)