aa122cbae7
This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: cynthia <cynthia@tvl.fyi> Reviewed-by: edef <edef@edef.eu> Reviewed-by: eta <tvl@eta.st> Reviewed-by: grfn <grfn@gws.fyi> |
||
---|---|---|
.. | ||
tests | ||
default.nix | ||
README.md |
Netstring
Netstrings are a djb invention. They are intended as a serialization format. Instead of inline control characters like \n
or \0
to signal the end of a string, they use a run-length encoding given as the number of bytes, encoded in ASCII, at the beginning of the string.
hello -> 5:hello,
foo! -> 4:foo!,
こんにちは -> 15:こんにちは,
They can be used to encode e.g. lists by simply concatenating and reading them in one-by-one.
If you need a more complex encoding, you could start encoding e.g. tuples as netstrings-in-netstrings, or you could use netencode
instead, which is what-if-json-but-netstrings, and takes the idea of netstrings to their logical conclusion.
Resources:
Spec: http://cr.yp.to/proto/netstrings.txt Wiki: https://en.wikipedia.org/wiki/Netstring