Newbie File I/O question

60 views
Skip to first unread message

rob....@yahoo.com

unread,
Oct 26, 2015, 8:56:26 PM10/26/15
to scalaz
Sorry for this newbie question, but can someone recommend a good place to start when working with file I/O with Scalaz? I have one small application that I’m writing for myself where I need to read and write a handful of small files, and a much larger application where I need to read, analyze, and potentially copy roughly a million files every day. The files aren't large, there's just a lot of them.

I read the main scalaz-stream page (https://github.com/scalaz/scalaz-stream) and this tutorial (https://gist.github.com/djspiewak/d93a9c4983f63721c41c), and I'm wondering, is this the best or preferred way to handle file I/O with Scalaz? I know that's a broad question, I'm just looking for a good place to start.

Thanks,
Rob

etorreborre

unread,
Oct 26, 2015, 10:04:58 PM10/26/15
to scalaz
Hi Rob,

My experience with scalaz-stream is that it is not suitable to the fast parsing / analyzing / writing of files because it is too slow. 
This might change in the future with the next version of scalaz-stream (fs2) but this would need to be benchmarked.

In the meantime you are basically left with the IO monad and Source.getLines. This is why I wrote a small library called "origami"
The idea to have ways to compose different operations on top of an existing "stream" of elements, provided by an iterator, a Scalaz-stream Process, an Akka stream...

The library hasn't been really battle-tested but there is some documentation and a presentation.

Eric.

rob....@yahoo.com

unread,
Oct 27, 2015, 6:26:41 PM10/27/15
to scalaz
Thank you. I saw the IO monad, but wasn't sure where to go with it. I'll check out origami.
Reply all
Reply to author
Forward
0 new messages