@cobol-ts/base64 0.0.14 → 0.0.17

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 +16 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,17 +1,24 @@
1
1
  # @cobol-ts/base64
2
2
 
3
- ## Purpose
3
+ Encode and decode UTF-8 strings to Base64 using TextEncoder/TextDecoder and btoa/atob.
4
4
 
5
- The `toBase64` and `fromBase64` helpers convert **UTF-8 strings** to and from Base64 text. They do not implement COBOL code-page conversion, encode arbitrary record ranges, or replace the byte-oriented `@cobol-ts/codec` package.
5
+ This API handles text, not arbitrary binary buffers or COBOL code pages.
6
6
 
7
- ## Interface
7
+ ## Usage
8
8
 
9
- ```ts
10
- import {toBase64, fromBase64} from '@cobol-ts/base64';
11
- const encoded = toBase64('Hello £');
12
- const decoded = fromBase64(encoded); // 'Hello £'
9
+ ```typescript
10
+ import {toBase64, fromBase64} from '@cobol-ts/base64'
11
+
12
+ const encoded = toBase64('café')
13
+ const decoded = fromBase64(encoded) // 'café'
13
14
  ```
14
15
 
15
- The encoder uses `TextEncoder` and `btoa`; the decoder uses `atob` and `TextDecoder`. Both rely on those host globals, and invalid Base64 input is not converted into a domain-specific error. For binary COBOL records, retain `Uint8Array` or `Buffer` and use the appropriate byte codec instead.
16
+ The implementation converts UTF-8 bytes to/from the Base64 binary-string API. It expects the runtime to provide `TextEncoder`, `TextDecoder`, `btoa` and `atob`; it is not a general byte-buffer codec.
17
+
18
+ ## Source and tests
19
+
20
+ **Public entry points:** [base64.ts](./src/base64.ts).
21
+
22
+ **Tests:** [base64.spec.ts](src/base64.spec.ts)
16
23
 
17
- Implementation: [`src/base64.ts`](src/base64.ts). Export surface: [`index.ts`](index.ts).
24
+ **Related:** [@cobol-ts/codec](../codec/README.md) · [@cobol-ts/string_utils](../strings/README.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cobol-ts/base64",
3
3
  "description": "utilities about base64 encoding",
4
- "version": "0.0.14",
4
+ "version": "0.0.17",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index",
7
7
  "browserslist": {