Flush any pending write operations to disk.


First available in version 3.7 build 197.

Input Parameters:


Output Parameters:

systemError - A system specific error code from the GetLastError function.

Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.BinaryFile.flushToDisk( paramsObject [, callbackParamsObject] [, errorParamsObject] );

Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.BinaryFile.flushToDisk( paramsObject );


One good reason to call flushToDisk is when you are writing data to removable media like a USB drives. This guarantees that any writes cached by Windows are flushed to disk so the data is saved properly if the drive is removed.



Create a file, write some data to it and call flushToDisk to make sure the file has been saved to disk before we close it. This forces Windows to empty its cache buffer for this file and commit the contents to disk.

ssCore.BinaryFile.create({path:"startdir://test.dat", accessMode:"write", failIfExists:"false"});
ssCore.BinaryFile.writeBytes({data:"i am the data", format:"utf8"});