thlorenz/exorcist — pull request #7 by dantman (2014-07-13 10:10:57+00:00)
Title: Implement WritableStream support for file and stop squelching errors

Besides cleaning up some trailing white-space I've implemented two things.

Firstly, I've implemented support for passing a writable stream as file instead of a string path of a file to write to.
- If a writable stream is used, url becomes non-optional.
- exorcist ends whatever writable stream is passed to it, it is not expected to write to one that expects to be able to write more after (I can't see any reason for that anyways)
- Writable streams are tested by duck-type to support 3rd party/old/new streams and non-fs.WriteStream writable streams
- For example, a personal use case I have is passing a map to an interface that expects a readable stream which it pipes to a write stream or a file of its own choosing. So I pass exorcist a stream.PassThrough which I then pass to the interface.

Secondly, I've changed writeFile so that if there is an error during writing to the file it is emitted into the stream instead of being squelched.