@robinpath/buffer
v0.1.1
Published
> Buffer and encoding utilities: base64, base64url, hex, byte operations
Keywords
Readme
@robinpath/buffer
Buffer and encoding utilities: base64, base64url, hex, byte operations
Why use this module?
The buffer module lets you:
- Create a base64 buffer from a string
- Convert a base64 buffer to string
- Create base64 from hex string
- Convert base64 to hex string
- Encode string to base64
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/bufferQuick Start
No credentials needed — start using it right away:
buffer.toString "aGVsbG8="Available Functions
| Function | Description |
|----------|-------------|
| buffer.fromString | Create a base64 buffer from a string |
| buffer.toString | Convert a base64 buffer to string |
| buffer.fromHex | Create base64 from hex string |
| buffer.toHex | Convert base64 to hex string |
| buffer.toBase64 | Encode string to base64 |
| buffer.fromBase64 | Decode base64 to string |
| buffer.toBase64Url | Encode string to URL-safe base64 |
| buffer.fromBase64Url | Decode URL-safe base64 to string |
| buffer.byteLength | Get the byte length of a string |
| buffer.concat | Concatenate multiple base64 buffers |
| buffer.compare | Compare two base64 buffers |
| buffer.isBase64 | Check if a string is valid base64 |
Examples
Convert a base64 buffer to string
buffer.toString "aGVsbG8="Create base64 from hex string
buffer.fromHex "48656c6c6f"Convert base64 to hex string
buffer.toHex "aGVsbG8="Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/buffer";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
buffer.toString "aGVsbG8="
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
