-
-
Notifications
You must be signed in to change notification settings - Fork 166
Structured Data Over Pipes
andychu edited this page Sep 27, 2017
·
11 revisions
- Use
%
format strings. This allows you to select fields. - Implement
%x00
likegit log
or\0
likefind
to insert NUL bytes - Use utf-8 encoding for strings
Advantages:
- Works with
xargs -0
(which was meant forfind -print0
- JSON for structured (and proper escaping)
- CSV for tabular data (and proper escaping)
- Also need a foo.csv_schema for the types. JSON has types in the encoding.
- Provide
%#s
for a length prefix, for truly binary data. What use cases exist?- Alternative: base64 encode
- Alternative: pass the file system path of the file (could be in memory on
tmpfs
).
- Netstrings -- for fixed formats