Grounds
    Preparing search index...

    Function RString

    • Creates a schema for string values.

      Strings are encoded as UTF-8 with a variable-length size prefix. The wire format encodes character count in bytes using a tagged varint: 7 bits for lengths 0-127, or 4 bytes little-endian for larger strings.

      Returns TRString

      A Relish schema for string values

      import { RString, createCodec } from '@grounds/schema';

      const codec = createCodec(RString());
      codec.encode('hello').match(
      (bytes) => console.log('String encoded:', bytes),
      (error) => console.error(error)
      );
      • RArray for arrays of strings
      • RMap for maps with string keys/values