HOT DOG Linux

HOT DOG Linux

Everything Is A Stream

One of the maxims of Unix is that ‘Everything is a file’. In Hot Dog Linux, it is more accurate to say that ‘Everything is a stream’. A file implies data that exists on some kind of storage unit that is written and then read back into memory at a later time. A file can be moved or deleted, and randomly accessed. And so on.

The way to send data from one process to another process is by using standard input and output, which are streams. A stream can be read one line at a time, and can be processed one line at a time, reducing memory requirements. Often times, files are loaded into memory in their entirety, and then processed. But this makes it impossible to handle large files that exceed the amount of RAM in a system.

To expand upon this philosophy, there should be a consistent data format that is trivial to parse. Data should be human-readable text. It should be line-oriented, with a newline indicating the end of each line. Each line represents a key-value dictionary, and each key-value pair is separated by whitespace. A key-value pair is separated by a colon `:’. Keys do not contain whitespace. If a value has whitespace, it is percent-encoded like with URL’s.

For example:

If a value has a space in it:

To parse a key-value pair in Perl:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top