## Methods

close()
flush()

write(arg)
writeBinary(str)

writeJson()
writeLine(str)

## new FOut(fileName[, append])

Output file stream.

### Example

    // import module
    var fs = require('qminer').fs;
    // open file in write mode
    var fout = new fs.FOut('file.txt');
    // write a line
    fout.writeLine('example text');
    // close
    fout.close();

### Parameters

Name | Type | Optional | Description
--- | --- | --- | ---
fileName | String |  | File name.
append | boolean | Yes | Append flag. Defaults to `false`.

## Methods

### close()

Closes the output stream.

#### Example

    // import module
    var fs = require('qminer').fs;
    // open file in write mode
    var fout = new fs.FOut('file.txt');
    // write a line
    fout.writeLine('example text');
    // close
    fout.close();

### flush() → module:fs.FOut

Flushes the output stream.

#### Example

    // import module
    var fs = require('qminer').fs;
    // open file in write mode
    var fout = new fs.FOut('file.txt');
    // write a line
    fout.writeLine('example text');
    // flush the stream
    fout.flush();
    // close
    fout.close();

Returns

  `module:fs.FOut`B Self.

### write(arg) → module:fs.FOut

Writes a string or number or a JSON object in human readable form.

#### Example

    // import module
    var fs = require('qminer').fs;
    // open file in write mode
    var fout = new fs.FOut('file.txt');
    // write a string
    fout.write('example text');
    // close
    fout.close();

#### Parameter

Name | Type | Optional | Description
--- | --- | --- | ---
arg | (String, Number, or Object) |  | Argument to write.

Returns

  `module:fs.FOut`B Self.

### writeBinary(str) → module:fs.FOut

Writes a string or number or a JSON object in binary form.

#### Example

    // import fs module
    var fs = require('qminer').fs;
    // save a string in binary form

#### Parameter

Name | Type | Optional | Description
--- | --- | --- | ---
str | (String, Number, or Object) |  | Argument to write.

Returns

  `module:fs.FOut`B Self.

### writeJson() → (Object or module:fs.FOut)

Saves json object, which can be read by `fs.FIn.readJson`.

#### Example

    // import fs module
    var fs = require('qminer').fs;
    // create and save a json using the writeJson method

Returns

  `Object`B obj - Json object to write.

  `module:fs.FOut`B Self.

### writeLine(str) → module:fs.FOut

Writes a string and adds a new line.

#### Example

    // import module
    var fs = require('qminer').fs;
    // open file in write mode
    var fout = new fs.FOut('file.txt');
    // write a line
    fout.writeLine('example text');
    // close
    fout.close();

#### Parameter

Name | Type | Optional | Description
--- | --- | --- | ---
str | String |  | String to write.

Returns

  `module:fs.FOut`B Self.