@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.
- package/README.md +16 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# @cobol-ts/base64
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Encode and decode UTF-8 strings to Base64 using TextEncoder/TextDecoder and btoa/atob.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This API handles text, not arbitrary binary buffers or COBOL code pages.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Usage
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
import {toBase64, fromBase64} from '@cobol-ts/base64'
|
|
11
|
-
|
|
12
|
-
const
|
|
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
|
|
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
|
-
|
|
24
|
+
**Related:** [@cobol-ts/codec](../codec/README.md) · [@cobol-ts/string_utils](../strings/README.md).
|