package data-encoding

  1. Overview
  2. Docs

Create encodings that produce data of a fixed length when binary encoded. See the preamble for an explanation.

val string : int -> string encoding
val bytes : int -> Bytes.t encoding
val add_padding : 'a encoding -> int -> 'a encoding

add_padding e n is a padded version of the encoding e. In Binary, there are n null bytes (\000) added after the value encoded by e. In JSON, padding is ignored.