# Null stream implementation

**URL:** <https://discourse.julialang.org/t/null-stream-implementation/32610>\
**Category:** General Usage\
**Created:** [December 23, 2019, 8:28am UTC](https://discourse.julialang.org/t/null-stream-implementation/32610 "2019-12-23T08:28:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [December 23, 2019, 8:28am UTC](https://discourse.julialang.org/t/null-stream-implementation/32610/1 "2019-12-23T08:28:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [December 23, 2019, 8:29am UTC](https://discourse.julialang.org/t/null-stream-implementation/32610/2 "2019-12-23T08:29:15Z")

</div>

Is this what you are looking for?

```julia
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))

```

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [December 23, 2019, 8:33am UTC](https://discourse.julialang.org/t/null-stream-implementation/32610/3 "2019-12-23T08:33:25Z")

</div>

Thanks @jw3126  
I was looking in [https://github.com/JuliaLang/julia/blob/master/base/iostream.jl](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](https://github.com/JuliaLang/julia/blob/75c10e435b2b9c947422ad38fa0b020595d3f747/base/coreio.jl)

and doc is very explicit about it [Essentials · The Julia Language](https://docs.julialang.org/en/v1/base/base/#Base.devnull)

Sorry for noise!
