File.flush()

NES2+Syntax

							file.flush()

Description

The flush() method of the File object is used to write buffered information to a file. This information is placed in a buffer when the write(), writeln(), and writeByte() methods are used. Note that this is not the same as the top-level flush function.

Example

Listing 8.77 opens a file for reading and another file for writing. If the file for reading exists, a string is written to the other file. The flush() method is used to write the actual buffer of information to the file.

Listing 8.77 Using the flush() Method
 <SERVER> // Open a log file var myLog = new File("/data/logs/today.log"); var mySummary = new File("/data/logs/summary.log"); myLog.open("r"); mySummary.open("w"); // See if the ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.