Null stream implementation

Hello,

I’m looking for a Julia implementation of a stream (inheriting from IO) that acts like /dev/null (but usable for any OS).

It would just ignore anything that is streamed to it (ie it should redirect file IO to nowhere). Does such a thing exist in the Julia standard library? Or do I have to roll my own?

Kind regards

Is this what you are looking for?

help?> devnull
search: devnull

  devnull

  Used in a stream redirect to discard all data written to it. Essentially
  equivalent to /dev/null on Unix or NUL on Windows. Usage:

  run(pipeline(`cat test.txt`, devnull))
4 Likes

Thanks @jw3126
I was looking in https://github.com/JuliaLang/julia/blob/master/base/iostream.jl but couldn’t find it there

it’s in fact defined in https://github.com/JuliaLang/julia/blob/75c10e435b2b9c947422ad38fa0b020595d3f747/base/coreio.jl

and doc is very explicit about it Essentials · The Julia Language

Sorry for noise!

1 Like