# Psych::Stream - ri - phpman

= [**Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown) < [Psych::Visitors::YAMLTree**](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AVisitors%3A%3AYAMLTree/markdown)

------------------------------------------------------------------------
= **Includes:**
## [Psych::Streaming](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStreaming/markdown) (from gem psych-5.4.0)

------------------------------------------------------------------------
= **Extended by:**
## [Psych::Streaming::ClassMethods](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStreaming%3A%3AClassMethods/markdown) (from gem psych-5.4.0)

(from gem psych-5.4.0)
------------------------------------------------------------------------
## [Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown) is a streaming YAML emitter.  It will not buffer your
YAML, but send it straight to an IO.

Here is an example use:

  stream = [Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown).new($stdout)
  stream.start
  stream.push({:foo => 'bar'})
  stream.finish

YAML will be immediately emitted to $stdout with no buffering.

[Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown)#start will take a block and ensure that
[Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown)#finish is called, so you can do this form:

  stream = [Psych::Stream](https://www.chedong.com/phpMan.php/perldoc/Psych%3A%3AStream/markdown).new($stdout)
  stream.start do |em|
    em.push(:foo => 'bar')
  end
------------------------------------------------------------------------
