Implement file stream writing