Both reading and writing files works, however, need to keep into account
that reading frames doesn't always fill the buffer completely.