Added methods for file resize. Added stream to write pieces.