ssCore.BinaryFile.create

Create a new file and open it for binary access.


Availability:

First available in version 3.7 build 197.


Input Parameters:

path - A fully qualified path. This parameter supports monikers.

accessMode - [Optional] - Desired file access mode. Valid values include: read,write. Default value is read.

shareMode - [Optional] - Desired file sharing mode. Valid values include: none,read,write. Default value is none.

failIfExists - [Optional] - Set this flag to true to return an error if the file already exists. Valid values include: false,true. Default value is false.


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


Notes:

Creates a new file or, if the failIfExists argument is set to false (the defaut), overwrites an existing file and opens it using the specified access mode. Setting the accessMode to "write" automatically includes read access as well.

Use the shareMode parameter to control how the new file should be shared with other processes. A share mode of "none" means that no other process will be able to access the file while this process has it open. A share mode of "read" means that other processes will be able to open the file in read mode, "write" means that other processes will be able to open the file for reading and writing.

                

Examples:

Only create the file if it doesn't already exist.

ssCore.BinaryFile.create({path:"startdir://file.dat", accessMode:"write", failIfExists:"true"});

Always create the file, overwrite it if it already exists.

ssCore.BinaryFile.create({path:"startdir://file.dat", accessMode:"write", failIfExists:"false"});