rewrite as simple-stream
change toFile interface