ssCore.BinaryFile.setSize

Set the size of the file.


Availability:

First available in version 3.7 build 197.


Input Parameters:

bytes - The new size of the file in bytes.


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.setSize( 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.setSize( paramsObject );


Notes:

This function can be used to truncate or extend the length of a file. If the file is extended, the contents of the file between the old EOF position and the new position are not defined.

This operation moves the file pointer to the new end of file position.

                

Examples:

Create an empty file that is 2147483647 bytes (1 byte less than 2GB) long. This instantly creates a very large file but the contents are undefined. Windows does not guarantee that the file will be zero-filled, just that the file size will be what you asked for.

ssCore.BinaryFile.create({path:"startdir://test.dat", accessMode:"write", failIfExists:"false"});
ssCore.BinaryFile.setSize({bytes:"2147483647"});
ssCore.BinaryFile.close({});