# Jaxer.FileUtils : Object
Return to: Jaxer Framework index

This is a general class that wraps XPCOM filesystem functionality and from which File and Dir objects are derived.

## Platform Support

Jaxer Server Framework | Jaxer Client Framework
--- | ---
1.0 | no

## Constructors

Constructor | Action | Jaxer Server Framework | Jaxer Client Framework
--- | --- | --- | ---
Jaxer.FileUtils Constructor() : Jaxer.FileUtils A helper object for filesystem access | Show Details | 1.0 | no

### Jaxer.FileUtils() : Jaxer.FileUtils

A helper object for filesystem access

Returns

Jaxer.FileUtils | Returns an instance of FileUtils.

Throws
    Throws a Exception containing the error code.

## Functions

Method | Action | Jaxer Server Framework | Jaxer Client Framework
--- | --- | --- | ---
append(String leafname) : String Changes the path of the filesystem object by appending the provided leaf value. | Show Details | 1.0 | no

Parameters

String | leafname | The leafname to be appended

Returns

String | The appended directory and leafname

Throws
    Throws a Exception containing the error code.

chromeToPath(String a) : String Convert a chrome path to a filesystem path | Show Details | 1.0 | no

Parameters

String | a | chrome path

Returns

String | the chrome path as a filesystem path

Throws
    Throws a Exception containing the error code.

copy(String source, String destination) : void Copies the source path to the destination path | Show Details | 1.0 | no

Parameters

String | source | path The source path
String | destination | path The destination apth

Throws
    Throws a Exception containing the error code.

create(String aPath) : void Creates a file on the filesystem with the default permissions | Show Details | 1.0 | no

Parameters

String | aPath | a file system path

Throws
    Throws a Exception containing the error code.

dateModified() : Object The last modified timestamp as reported by the OS | Show Details | 1.0 | no

Returns

Object | a date object representing the last modified timestamp of the file

Throws
    Throws a Exception containing the error code.

exists() : Boolean A boolean indicator of whether the referenced object physically exists on the filesystem. | Show Details | 1.0 | no

Returns

Boolean | true if file exists otherwise false

Throws
    Throws a Exception containing the error code.

ext(String aPath) : String Returns the extension of the file object | Show Details | 1.0 | no

Parameters

String | aPath | The path to the filesystem object

Returns

String | the file extension of the referenced filesytem object

Examples

       var p='/tmp/foo.dat'; var f=new File(p); alert(f.ext);

  outputs: dat
Throws
    Throws a Exception containing the error code.

isValidPath(String aPath) : Boolean Returns a boolean indicator that is true for a valid path and false otherwise | Show Details | 1.0 | no

Parameters

String | aPath | a file system path

Returns

Boolean | true if valid path was requested

Throws
    Throws a Exception containing the error code.

leaf(String a) : String Returns the leaf (filename + extension) portion of the file path | Show Details | 1.0 | no

Parameters

String | a | filesystem path

Returns

String | The leaf name

Throws
    Throws a Exception containing the error code.

nsIFile(String aPath) : Object Returns an nsIFIle object for the specified path | Show Details | 1.0 | no

Parameters

String | aPath | a file system path

Returns

Object | nsIFile

Throws
    Throws a Exception containing the error code.

parent(String aPath) : String Returns the path of the parent filesystem object | Show Details | 1.0 | no

Parameters

String | aPath | The path to the filesystem object

Returns

String | The path of the parent file system object

pathToURL(String a) : String Convert a filesystem path to a file protocol URL | Show Details | 1.0 | no

Parameters

String | a | path

Returns

String | the filesystem path as a URL

Throws
    Throws a Exception containing the error code.

permissions() : String Get the file permissions for the File object | Show Details | 1.0 | no

Returns

String | the chmod style permissions of the file

Throws
    Throws a Exception containing the error code.

remove() : void Removes the referenced object physically from the filesystem. | Show Details | 1.0 | no

Throws
    Throws a Exception containing the error code.

run(String aPath, Array aArgs) : Number Trys to execute the requested file as a separate *non-blocking* process. Passes the supplied *array* of arguments on the command line if the OS supports it. | Show Details | 1.0 | no

Parameters

String | aPath | a filesystem path
Array | aArgs | a set of arguments passed to the command to be run

Returns

Number | the exit code of the process

Throws
    Throws a Exception containing the error code.

size(String source) : Number Returns the size in bytes as reported by the OS | Show Details | 1.0 | no

Parameters

String | source | path The path to the filesystem object

Returns

Number | the size of the file in bytes

Throws
    Throws a Exception containing the error code.

urlToPath(String a) : String Convert a file protocol URL to a filesystem path | Show Details | 1.0 | no

Parameters

String | a | URL

Returns

String | the URL as a filesystem path

Throws
    Throws a Exception containing the error code.

validatePermissions(Number the) : Boolean This function will validate the numeric permissions value provided, if true the permissions value is valid, if false the value is invalid. | Show Details | 1.0 | no

Parameters

Number | the | chmod style permission (0777,0622 etc)

Returns

Boolean | indicates whether the permissions are valid

Throws
    Throws a Exception containing the error code.

aptana_docs