API reference@evolu/commonType › idToIdBytes

function idToIdBytes(
  value: string & Brand<"Id">,
): Uint8Array<ArrayBufferLike> & Brand<"Length16"> & Brand<"IdBytes">;

Defined in: packages/common/src/Type.ts:6175

Converts an Id to IdBytes.

Example

import { assertEqual, createIdFromString, idToIdBytes } from "@evolu/common";

const bytes = idToIdBytes(createIdFromString("todo"));

assertEqual(bytes.length, 16);