1

I'd like to create a file similar to those under /dev that I can stream lines of text to without actually writing anything to the disk. I want to still be able to read this stream like a regular text file.

1 Answer 1

2

Call the os.mkfifo function, then open the file it creates as normal. Anything that gets written by one process will get read back out by another, and not saved to disk or anywhere else along the way. Note that reads and writes will block (i.e. appear to hang) if one process gets too far ahead of the other.

Alternatively, you can use the socket library to create a UNIX domain socket, which is bidirectional and has more features, but is more complicated to set up.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.