User Tools

Site Tools


en:code:data:file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
code:data:file [2011/01/24 21:02] jmgren:code:data:file [2021/02/13 11:23] (current) – external edit 127.0.0.1
Line 17: Line 17:
 var myObject = new File(); var myObject = new File();
 </code> </code>
 +
 +==== copy ====
 +Copy a file.
 +
 +=== Syntax ===
 +<code javascript>
 +File.copy(source, destination);
 +</code>
 +<code javascript>
 +File.copy(source, destination, options);
 +</code>
 +
 +=== Arguments ===
 +  - source - (string) the source file to copy
 +  - destination - (string) the destination file/directory
 +  - options - (object) [//Added in Actionaz 3.0.1.//]
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true)
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true)
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true)
 +    * createDestinationDirectory - (bool) should the destination directory be created if it doesn't exist (Linux only, default: true)
 +
 +=== Returns ===
 +  * (null) nothing
 +
 +=== Exceptions ===
 +  * (ParameterCountError) incorrect parameter count
 +  * (DirectoryCreationError) unable to create the destination directory (Linux only)
 +  * (DirectoryDoesntExistError) the destination directory doesn't exist (Linux only)
 +  * (CopyError) copy failed
 +  * (CopyAbortedError) copy aborted (Windows only)
 +
 +==== move ====
 +Move a file.
 +
 +=== Syntax ===
 +<code javascript>
 +File.move(source, destination);
 +</code>
 +<code javascript>
 +File.move(source, destination, options);
 +</code>
 +
 +=== Arguments ===
 +  - source - (string) the source file to move
 +  - destination - (string) the destination file/directory
 +  - options - (object) [//Added in Actionaz 3.0.1.//]
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true)
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true)
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true)
 +    * createDestinationDirectory - (bool) should the destination directory be created if it doesn't exist (Linux only, default: true)
 +
 +=== Returns ===
 +  * (null) nothing
 +
 +=== Exceptions ===
 +  * (ParameterCountError) incorrect parameter count
 +  * (DirectoryCreationError) unable to create the destination directory (Linux only)
 +  * (DirectoryDoesntExistError) the destination directory doesn't exist (Linux only)
 +  * (MoveError) move failed
 +  * (MoveAbortedError) move aborted (Windows only)
 +
 +==== rename ====
 +This function is an alias of the [[#move|move]] function.
 +
 +==== remove ====
 +Remove a file.
 +
 +=== Syntax ===
 +<code javascript>
 +File.remove(filename);
 +</code>
 +<code javascript>
 +File.remove(filename, options);
 +</code>
 +
 +=== Arguments ===
 +  - filename - (string) the file to remove
 +  - options - (object) [//Added in Actionaz 3.0.1.//]
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true)
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true)
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true)
 +    * allowUndo - (bool) should the file/directory be moved to the trash bin (Windows only, default: false)
 +
 +=== Returns ===
 +  * (null) nothing
 +
 +=== Exceptions ===
 +  * (ParameterCountError) incorrect parameter count
 +  * (RemoveError) remove failed
 +  * (RemoveAbortedError) remove aborted (Windows only)
  
 ===== Methods ===== ===== Methods =====
Line 25: Line 115:
 === Syntax === === Syntax ===
 <code javascript> <code javascript>
-myObject.open(filename, mode);+myObject.open(filename, openMode);
 </code> </code>
  
 === Arguments === === Arguments ===
   - filename - (string) the filename of the file to open   - filename - (string) the filename of the file to open
-  - mode - ([[#mode|Mode]]) the open mode+  - openMode - ([[#openmode|OpenMode]]) the open mode
  
 === Returns === === Returns ===
Line 50: Line 140:
  
 === Arguments === === Arguments ===
-  - data - ([[code:core:rawdata|RawData]]) the data to write+  - data - ([[en:code:core:rawdata|RawData]]) the data to write
   - other - (mixed) the data to write   - other - (mixed) the data to write
  
Line 72: Line 162:
 === Arguments === === Arguments ===
   - text - (string) the text to write   - text - (string) the text to write
-  - encoding - ([[code:core:global#encoding|Encoding]]) the encoding to use+  - encoding - ([[en:code:core:global#encoding|Encoding]]) the encoding to use
  
 === Returns === === Returns ===
Line 89: Line 179:
  
 === Returns === === Returns ===
-  * ([[code:core:rawdata|RawData]]) the raw data read from the file+  * ([[en:code:core:rawdata|RawData]]) the raw data read from the file
  
 ==== readText ==== ==== readText ====
Line 103: Line 193:
  
 === Arguments === === Arguments ===
-  - encoding - ([[code:core:global#encoding|Encoding]]) the encoding to use+  - encoding - ([[en:code:core:global#encoding|Encoding]]) the encoding to use
  
 === Returns === === Returns ===
Line 127: Line 217:
 </code> </code>
 <code javascript> <code javascript>
-myObject.copy(destination, createDestinationDirectory);+myObject.copy(destination, options);
 </code> </code>
  
 === Arguments === === Arguments ===
   - destination - (string) the location where to copy the file   - destination - (string) the location where to copy the file
-  - createDestinationDirectory - (booleancreate the destination directory (default: true)+  - options - (object) [//Added in Actionaz 3.0.1.//] 
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true) 
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true) 
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true) 
 +    * createDestinationDirectory - (boolshould the destination directory be created if it doesn't exist (Linux only, default: true)
  
 === Returns === === Returns ===
Line 138: Line 232:
  
 === Exceptions === === Exceptions ===
-  * (DirectoryCreationError) unable to create the destination directory +  * (ParameterCountError) incorrect parameter count 
-  * (DirectoryDoesntExistError) the destination directory doesn't exist+  * (DirectoryCreationError) unable to create the destination directory (Linux only) 
 +  * (DirectoryDoesntExistError) the destination directory doesn't exist (Linux only)
   * (CopyError) copy failed   * (CopyError) copy failed
 +  * (CopyAbortedError) copy aborted (Windows only)
  
 ==== move ==== ==== move ====
Line 150: Line 246:
 </code> </code>
 <code javascript> <code javascript>
-myObject.move(destination, createDestinationDirectory);+myObject.move(destination, options);
 </code> </code>
  
 === Arguments === === Arguments ===
   - destination - (string) the location where to move the file   - destination - (string) the location where to move the file
-  - createDestinationDirectory - (booleancreate the destination directory (default: true)+  - options - (object) [//Added in Actionaz 3.0.1.//] 
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true) 
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true) 
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true) 
 +    * createDestinationDirectory - (boolshould the destination directory be created if it doesn't exist (Linux only, default: true)
  
 === Returns === === Returns ===
Line 161: Line 261:
  
 === Exceptions === === Exceptions ===
-  * (DirectoryCreationError) unable to create the destination directory +  * (ParameterCountError) incorrect parameter count 
-  * (DirectoryDoesntExistError) the destination directory doesn't exist +  * (DirectoryCreationError) unable to create the destination directory (Linux only) 
-  * (MoveRenameError) move failed+  * (DirectoryDoesntExistError) the destination directory doesn't exist (Linux only) 
 +  * (MoveError) move failed 
 +  * (MoveAbortedError) move aborted (Windows only)
  
 ==== rename ==== ==== rename ====
-This method is an alias of the [[#move|move]] method.+This method is an alias of the [[#move1|move]] method.
  
 ==== remove ==== ==== remove ====
Line 174: Line 276:
 <code javascript> <code javascript>
 myObject.remove(); myObject.remove();
 +</code>
 +<code javascript>
 +myObject.remove(options);
 </code> </code>
 +
 +=== Arguments ===
 +  - options - (object) [//Added in Actionaz 3.0.1.//]
 +    * noErrorDialog - (bool) should an error dialog be shown if an error occurs (Windows only, default: true)
 +    * noConfirmDialog - (bool) should a confirmation dialog be shown if needed (Windows only, default: true)
 +    * noProgressDialog - (bool) should a progress dialog be shown (Windows only, default: true)
 +    * allowUndo - (bool) should the file/directory be moved to the trash bin (Windows only, default: false)
  
 === Returns === === Returns ===
Line 180: Line 292:
  
 === Exceptions === === Exceptions ===
 +  * (ParameterCountError) incorrect parameter count
   * (RemoveError) remove failed   * (RemoveError) remove failed
 +  * (RemoveAbortedError) remove aborted (Windows only)
 +
 +===== Enumerations =====
 +
 +==== OpenMode ====
 +File open mode.
 +
 +=== Values ===
 +  - ReadOnly: file opened for reading only
 +  - WriteOnly: file opened for writing only
 +  - ReadWrite: file opened for reading and writing
 +  - Append: file opened for writing at the end of the file
 +  - Truncate: file opened for writing, erases any previous content
 +  - Text: file opened in text mode
 +  - Unbuffered: file opened in unbuffered mode
 +
 +=== Notes ===
 +This is a flag enumeration, that means that you can use multiple values using the | operator.
 +Example:
 +<code javascript>
 +myObject.open("myfile.txt", File.WriteOnly | File.Append | File.Text);
 +</code>
en/code/data/file.1295902935.txt.gz · Last modified: 2021/02/13 11:23 (external edit)