https://github.com/nurliman/base85
Browser and Node.js-compatible Base85 encoder/decoder.
https://github.com/nurliman/base85
ascii85 base85 deno jsr node
Last synced: 14 days ago
JSON representation
Browser and Node.js-compatible Base85 encoder/decoder.
- Host: GitHub
- URL: https://github.com/nurliman/base85
- Owner: nurliman
- License: mit
- Created: 2023-12-28T09:24:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-16T06:31:57.000Z (4 months ago)
- Last Synced: 2025-04-01T12:53:32.375Z (25 days ago)
- Topics: ascii85, base85, deno, jsr, node
- Language: TypeScript
- Homepage: https://github.com/nurliman/base85
- Size: 411 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @nurliman/base85
[](https://jsr.io/@nurliman/base85)
[](https://jsr.io/@nurliman/base85)
[](https://www.npmjs.com/package/@nurliman/base85)## Description
`@nurliman/base85` is a Base85 encoder and decoder that compatible for Node.js and browser.
## Installation
To install the package, run the following command:
```bash
npm install @nurliman/base85
```## Usage
Import the package into your project:
```js
import { encodeBase85, decodeBase85 } from "@nurliman/base85";const encoded = encodeBase85("your string");
const decoded = decodeBase85(encoded);
```using default import:
```js
import base85 from "@nurliman/base85";const encoded = base85.encode("your string");
const decoded = base85.decode(encoded);
```using require:
```js
const { encodeBase85, decodeBase85 } = require("@nurliman/base85");const encoded = encodeBase85("your string");
const decoded = decodeBase85(encoded);
```Please replace `'your string'` with the string you want to encode and decode.
### EncodeOptions
`EncodeOptions` is an object that can be passed to the encode function to customize its behavior. It has the following properties:
- `wrap`: If true, the encoded string will be wrapped in `<~` and `~>`. Defaults to `true`.
Here's an example of how to use it:
```js
import base85 from "@nurliman/base85";const result = base85.encode("Hello World!");
console.log(result);
// <~87cURD]i,"Ebo80~>const result = base85.encode("Hello World!", {
wrap: false, // Set this to false if you don't want the output to be wrapped
});
console.log(result);
// 87cURD]i,"Ebo80
```### Decode
```js
import base85 from "@nurliman/base85";const result = base85.decode('<~87cURD]i,"Ebo80~>');
console.log(result);
// Hello World!// it also works without the wrapping characters
const result = base85.decode('87cURD]i,"Ebo80');
console.log(result);
// Hello World!
```## Author
[Nurliman Diara](https://nurliman.dev)
## License
This project is licensed under the MIT License.