@robinpath/buffer 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +95 -0
  2. package/package.json +25 -7
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @robinpath/buffer
2
+
3
+ > Buffer and encoding utilities: base64, base64url, hex, byte operations
4
+
5
+ ![Category](https://img.shields.io/badge/category-Utility-blue) ![Functions](https://img.shields.io/badge/functions-12-green) ![Auth](https://img.shields.io/badge/auth-none-lightgrey) ![License](https://img.shields.io/badge/license-MIT-brightgreen)
6
+
7
+ ## Why use this module?
8
+
9
+ The `buffer` module lets you:
10
+
11
+ - Create a base64 buffer from a string
12
+ - Convert a base64 buffer to string
13
+ - Create base64 from hex string
14
+ - Convert base64 to hex string
15
+ - Encode string to base64
16
+
17
+ All functions are callable directly from RobinPath scripts with a simple, consistent API.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @robinpath/buffer
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ No credentials needed — start using it right away:
28
+
29
+ ```robinpath
30
+ buffer.toString "aGVsbG8="
31
+ ```
32
+
33
+ ## Available Functions
34
+
35
+ | Function | Description |
36
+ |----------|-------------|
37
+ | `buffer.fromString` | Create a base64 buffer from a string |
38
+ | `buffer.toString` | Convert a base64 buffer to string |
39
+ | `buffer.fromHex` | Create base64 from hex string |
40
+ | `buffer.toHex` | Convert base64 to hex string |
41
+ | `buffer.toBase64` | Encode string to base64 |
42
+ | `buffer.fromBase64` | Decode base64 to string |
43
+ | `buffer.toBase64Url` | Encode string to URL-safe base64 |
44
+ | `buffer.fromBase64Url` | Decode URL-safe base64 to string |
45
+ | `buffer.byteLength` | Get the byte length of a string |
46
+ | `buffer.concat` | Concatenate multiple base64 buffers |
47
+ | `buffer.compare` | Compare two base64 buffers |
48
+ | `buffer.isBase64` | Check if a string is valid base64 |
49
+
50
+ ## Examples
51
+
52
+ ### Convert a base64 buffer to string
53
+
54
+ ```robinpath
55
+ buffer.toString "aGVsbG8="
56
+ ```
57
+
58
+ ### Create base64 from hex string
59
+
60
+ ```robinpath
61
+ buffer.fromHex "48656c6c6f"
62
+ ```
63
+
64
+ ### Convert base64 to hex string
65
+
66
+ ```robinpath
67
+ buffer.toHex "aGVsbG8="
68
+ ```
69
+
70
+ ## Integration with RobinPath
71
+
72
+ ```typescript
73
+ import { RobinPath } from "@wiredwp/robinpath";
74
+ import Module from "@robinpath/buffer";
75
+
76
+ const rp = new RobinPath();
77
+ rp.registerModule(Module.name, Module.functions);
78
+ rp.registerModuleMeta(Module.name, Module.functionMetadata);
79
+
80
+ const result = await rp.executeScript(`
81
+ buffer.toString "aGVsbG8="
82
+ `);
83
+ ```
84
+
85
+ ## Full API Reference
86
+
87
+ See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
88
+
89
+ ## Related Modules
90
+
91
+ - [`@robinpath/json`](../json) — JSON module for complementary functionality
92
+
93
+ ## License
94
+
95
+ MIT
package/package.json CHANGED
@@ -1,13 +1,31 @@
1
1
  {
2
2
  "name": "@robinpath/buffer",
3
- "version": "0.1.0",
4
- "publishConfig": { "access": "public" },
3
+ "version": "0.1.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
5
7
  "type": "module",
6
8
  "main": "dist/index.js",
7
9
  "types": "dist/index.d.ts",
8
- "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } },
9
- "files": ["dist"],
10
- "scripts": { "build": "tsc", "test": "node --import tsx --test tests/*.test.ts" },
11
- "peerDependencies": { "@wiredwp/robinpath": ">=0.20.0" },
12
- "devDependencies": { "@wiredwp/robinpath": "^0.30.1", "tsx": "^4.19.0", "typescript": "^5.6.0" }
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "test": "node --import tsx --test tests/*.test.ts"
22
+ },
23
+ "peerDependencies": {
24
+ "@wiredwp/robinpath": ">=0.20.0"
25
+ },
26
+ "devDependencies": {
27
+ "@wiredwp/robinpath": "^0.30.1",
28
+ "tsx": "^4.19.0",
29
+ "typescript": "^5.6.0"
30
+ }
13
31
  }