Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 683 Bytes

ksuid.md

File metadata and controls

31 lines (23 loc) · 683 Bytes

Function

ksuid — encode/decode KSUID-style unique identifiers

Synopsis

ksuid() -> bytes
ksuid(b: bytes) -> string
ksuid(s: string) -> bytes

Description

The ksuid function either encodes a KSUID (a byte sequence of length 20) b into a Base62 string or decodes a KSUID Base62 string into a 20-byte Zed bytes value.

If ksuid is called with no arguments, a new KSUID is generated and returned as a bytes value.

Example:

echo  '{id:0x0dfc90519b60f362e84a3fdddd9b9e63e1fb90d1}' |
  super -z -c 'id := ksuid(id)' -

=>

{id:"1zjJzTWWCJNVrGwqB8kZwhTM2fR"}