# FileOutputStream constructor

FileOutputStream(

1. String name, {
2. bool append = false,

})

Creates a file output stream to write to the file with the specified name.

## Parameters

- `name`: The system-dependent filename
- `append`: If true, bytes will be written to the end of the file rather than the beginning (default: false)

## Example

    // Create new file or overwrite existing
    final output = FileOutputStream('output.txt');

    // Append to existing file
    final appendOutput = FileOutputStream('log.txt', append: true);

Throws IOException if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason.

A file output stream is an output stream for writing data to a File or to a file descriptor.

FileOutputStream is meant for writing streams of raw bytes such as image data. For writing streams of characters, consider using FileWriter.

## Example Usage

    // Writing binary data
    final output = FileOutputStream('output.bin');
    try {
      final data = Uint8List.fromList([0x89, 0x50, 0x4E, 0x47]); // PNG header
      await output.writeBytes(data);
      await output.flush();
    } finally {
      await output.close();
    }

    // Appending to existing file
    final output = FileOutputStream('log.txt', append: true);
    try {
      await output.writeString('New log entry\n');
      await output.flush();
    } finally {
      await output.close();
    }

## Implementation

    FileOutputStream(String name, {bool append = false})
        : _file = File(name), _append = append;