Skip to content

Commit 9da96f0

Browse files
committed
readme: add thumbprint, fix cap typos
1 parent c8c5ab4 commit 9da96f0

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ stop()
244244

245245
## πŸ₯¨ stz data utilities
246246

247+
### 🍏 txt
248+
> convert to/from utf8 string format
249+
- `txt.fromBytes(bytes)` β€” bytes to string
250+
- `txt.toBytes(string)` β€” string to bytes
251+
252+
### 🍏 bytes
253+
> utilities for dealing with Uint8Array
254+
- `bytes.eq(bytesA, bytesB)` β€” check if two byte arrays are equal
255+
- `bytes.random(32)` β€” generate crypto-random bytes
256+
247257
### 🍏 BaseX utilities
248258
> convert binary data to/from various encodings
249259

@@ -284,16 +294,6 @@ import {hex, base58, base64} from "@e280/stz"
284294
- `1uK3au` base62 epoch seconds (6 chars)
285295
- *nice*
286296

287-
### 🍏 txt
288-
> convert to/from utf8 string format
289-
- `txt.fromBytes(bytes)` β€” bytes to string
290-
- `txt.toBytes(string)` β€” string to bytes
291-
292-
### 🍏 bytes
293-
> utilities for dealing with Uint8Array
294-
- `bytes.eq(bytesA, bytesB)` β€” check if two byte arrays are equal
295-
- `bytes.random(32)` β€” generate crypto-random bytes
296-
297297
### 🍏 bytename
298298
> friendly string encoding for binary data
299299

@@ -318,14 +318,24 @@ import {bytename} from "@e280/stz"
318318
0xDE, 0xAD, 0xBE, 0xEF,
319319
])
320320
321-
Bytename.fromBytes(data, {
321+
bytename.fromBytes(data, {
322322
groupSize: 2, // default is 4
323323
groupSeparator: " ",
324324
wordSeparator: ".",
325325
})
326326
// "ribmug.hilmun ribmug.hilmun"
327327
```
328328

329+
### 🍏 thumbprint
330+
> hybrid of bytename and base58 to make binary data more human-friendly
331+
- looks like `nodlyn.fasrep.habbud.ralwel.Avo7gFmdWMRHkwsD149mcaBoZdS69iXuJ`
332+
- the idea is that the first parts are in bytename format, so it's easy for humans to recognize
333+
- and the remaining data is shown in base58
334+
- `thumbprint.fromBytes(u8array)` β€” encode bytes to thumbprint string
335+
- `thumbprint.toBytes(thumbstring)` β€” decode thumbprint string to bytes
336+
- `thumbprint.fromHex(hexstring)` β€” convert a hex string into a thumbprint
337+
- `thumbprint.toHex(thumbstring)` β€” convert a thumbprint into a hex string
338+
329339
### 🍏 toq
330340
> tar-like binary file format for efficiently packing multiple files together
331341

@@ -363,7 +373,7 @@ import {toq, txt} from "@e280/stz"
363373
- **pack a map of files**
364374
```ts
365375
const files = new Map<string, Uint8Array>()
366-
files.set("hello.txt", Txt.toBytes("hello world"))
376+
files.set("hello.txt", txt.toBytes("hello world"))
367377
files.set("deadbeef.data", new Uint8Array([0xDE, 0xAD, 0xBE, 0xEF]))
368378
369379
const pack = toq.pack(files)

0 commit comments

Comments
Β (0)