Jaxer.Dir : Jaxer.Filesystem
Return to: Jaxer Framework index

Utility object for filesystem directory access.

Platform Support

Jaxer Server FrameworkJaxer Client Framework
1.0no

Constructors

ConstructorActionJaxer Server FrameworkJaxer Client Framework
Jaxer.Dir Constructor(String aPath) : Jaxer.Dir
Creates a new Directory handle for performing filesystem directory operations.
Show Details1.0no

Jaxer.Dir(String aPath) : Jaxer.Dir

Creates a new Directory handle for performing filesystem directory operations.

Parameters
StringaPatha java style path object where double backslash is used as a folder hierarchy delimiter

Returns
Jaxer.Dira Dir object reference initialized to the provided path.

Throws
Throws an exception containing the error code.

Inherited Properties

PropertyActionJaxer Server FrameworkJaxer Client Framework
dateModified : Object
The last modified timestamp as reported by the OS.
No Details 1.0no
exists : Boolean
A boolean indicator of whether the referenced object physically exists on the filesystem.
No Details 1.0no
isDir : Boolean
A boolean indicator of whether the referenced object is a folder/directory
No Details 1.0no
isExec : Boolean
A boolean indicator of whether the referenced object is an executable
No Details 1.0no
isFile : Boolean
A boolean indicator of whether the referenced object is a file
No Details 1.0no
isFolder : Boolean
A boolean indicator of whether the referenced object is a folder/directory an alias of as isDir
No Details 1.0no
isHidden : Boolean
A boolean indicator of whether the referenced object is hidden
No Details 1.0no
isReadable : Boolean
A boolean indicator of whether the referenced object is readable
No Details 1.0no
isSpecial : Boolean
A boolean indicator of whether the referenced object is special. NOTE: Not implemented on Mac and possibly other systems.
No Details 1.0no
isSymlink : Boolean
A boolean indicator of whether the referenced object is a symlink
No Details 1.0no
isWritable : Boolean
A boolean indicator of whether the referenced object is writable
No Details 1.0no
leaf : String
Get/Set the leaf (filename + extension) portion of the file path.
No Details 1.0no
nsIFile : Object
Returns a clone of the underlying nsIFile object.
No Details 1.0no
path : String
Returns the path of the refererenced filesystem object.
No Details 1.0no
permissions : String
Get/Set the file permissions for the File object. this may be ignored/misreported by some versions of windows. on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
No Details 1.0no
URL : String
Return the path of the referenced object as a file URL
No Details 1.0no

Functions

MethodActionJaxer Server FrameworkJaxer Client Framework
clone() : Jaxer.Dir
Clone a directory object
Show Details1.0no

Returns
Jaxer.Diran new Dir Object cloned from the original

Throws
Throws an Exception containing the error code.
contains(Object aFileObj) : Boolean
Tests whether a file Object exists in the Physical directory referenced by the Dir object
Show Details1.0no

Parameters
ObjectaFileObjthe aFileObj parameter may be either a JSLib file object or a string containing the name of the object.

Returns
BooleanTrue/False indicates whether the file was found;

Throws
Throws an Exception containing the error code.
create(String aPermissions) : void
Creates a new folder under the referenced path of the directory object The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
Show Details1.0no

Parameters
StringaPermissionsThe permissions used to create the filesystem object.

Throws
Throws a Exception containing the error code if filesytem object is unable to be created.
createHierarchy(String aPermissions) : void
Creates a hierarchy of folders as needed to contain the current folder's path. The format of the permissions is the same as for the create method.
Show Details1.0no

Parameters
StringaPermissionsThe permissions used to create al the filesystem objects

Throws
Throws a Exception containing the error code if any filesytem object is unable to be created.
createUnique(String aPermissions) : void
Create a new unique folder under the referenced path of the directory object The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
Show Details1.0no

Parameters
StringaPermissionsThe permissions used to create the filesystem object, this may be ignored by some versions of windows.

Throws
Throws an Exception containing the error code.
readDir() : Jaxer.Filesystem[]
Read the contents of a directory
Show Details1.0no

Returns
Jaxer.Filesystem[]an Array of Filesystem Objects, with no sort order explicitly set.

Throws
Throws an Exception containing the error code.
remove(Boolean aRecursive) : void
Removes specified folder from the file system
Show Details1.0no

Parameters
BooleanaRecursiveTrue/False value to indicate whether the removal includes subfolders.

Throws
Throws a Exception containing the error code.
static combine(String ...) : String
Combines any number of path fragments into a single path, using the current operating system's filesystem path separator. Before joining two fragments with the path separator, it strips any existing path separators on the fragment ends to be joined
Show Details1.0no

Parameters
String...Takes any number of string path fragments

Returns
StringThe fragments joined into a path

static create(String path, String aPermissions) : Jaxer.Dir
Creates a new folder (directory) at the specified path and returns it The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
Show Details1.0no

Parameters
StringpathThe path of the new folder
StringaPermissionsThe permissions used to create the filesystem object.

Returns
Jaxer.DirThe new directory object

Throws
Throws a Exception containing the error code if filesytem object is unable to be created.
static createHierarchy(String path, String aPermissions) : Jaxer.Dir
Creates a hierarchy of folders as needed to contain the current folder's path. The format of the permissions is the same as for the create method.
Show Details1.0no

Parameters
StringpathThe path of the new folder
StringaPermissionsThe permissions used to create all the filesystem objects

Returns
Jaxer.DirThe new directory object

Throws
Throws a Exception containing the error code if filesytem object is unable to be created.
static exists(String path) : Boolean
Does the directory exist on disk?
Show Details1.0no

Parameters
StringpathThe full or partial (to be resolved) path to test

Returns
Booleantrue if exists, false otherwise

static grep(String path, [Object options]) : Jaxer.File[]
Scan a folder tree from the provided path and find files that match the provided regular expression pattern. The available options properties are
  • pattern : a string containing a regular expression e.g. "^.*\.js$"
  • flags : the flags to use with the regular expression, e.g. "i" to ignore case
  • recursive: true/false indication of whether to search sub folders for the match
Show Details1.0no

Parameters
StringpathThe starting path for the search. This must be a folder.
Objectoptions(optional)Optional An Associative Array of optional parameters

Returns
Jaxer.File[]An Array of Jaxer.File objects that matched the provided pattern

Throws
A Jaxer.Exception object is thrown when the path is not a valid folder
static map(String path, [Object options,] [Function(Jaxer.File)->Object fn]) : Object[]
Scan a folder tree from the provided path and find files that match the provided regular expression pattern and run the provided function against each match
Show Details1.0no

Parameters
StringpathThe starting path for the search. This must be a folder.
Objectoptions(optional)Optional An Associative Array of optional parameters
Function(Jaxer.File)->Objectfn(optional)Optional The function to run. It will be invoked for each the matched Jaxer.File object, with the Jaxer.File object being passed as its parameter

Returns
Object[]An Array of objects created by invoking the provided function on each file which matched the provided pattern

Throws
A Jaxer.Exception object is thrown when the path is not a valid folder
static pathToUrl(String path) : null|String
Convert a native filesystem path to a URL format, which will begin with "file:...".
Show Details1.0no

Parameters
StringpathThe full path to be converted

Returns
nullThe URL, or null if the path could not be converted
StringThe URL, or null if the path could not be converted

static resolve(String pathToResolve, [String referencePath]) : String
Resolves a path to an absolute path on the filesystem, using as a reference (base) the given path or the current page's path.
Show Details1.0no

Parameters
StringpathToResolveThe path to resolve, e.g. a filename. It can also be a resource pattern (e.g. "resource:///...") or a file pattern (e.g. "file:///...")
StringreferencePath(optional)An optional path to use as a reference. By default, it uses the current page's path.

Returns
StringThe full path on the filesystem

static urlToPath(String url) : null|String
Convert a URL in string format to a native filesystem path. The URL must begin with "file:..."
Show Details1.0no

Parameters
StringurlThe URL to convert

Returns
nullThe full path, or null if the URL could not be converted
StringThe full path, or null if the URL could not be converted

Inherited Functions

MethodActionJaxer Server FrameworkJaxer Client Framework
append(String leafname) : String
Changes the path of the filesystem object by appending the provided leaf value.
Show Details1.0no

Parameters
StringleafnameThe leafname to be appended

Returns
StringThe appended directory and leafname

Throws
Throws a Exception containing the error code.
appendRelativePath(String relative) : void
This method is used for appending a relative path to the current filesystem object
Show Details1.0no

Parameters
Stringrelativepath

Throws
Throws a Exception containing the error code.
equals(Object a) : Boolean
Evaluates whether the current filesystem object refers to the same file as the one provided as a parameter
Show Details1.0no

Parameters
Objectafile system object to be compared

Returns
Booleantrue if object refers to same filesystem object, false otherwise

Throws
Throws a Exception containing the error code.
initPath(Array a) : String
This method will initialize the file system object with the provided path information (or will attempt to derive the path if an object is provided). An existing File object can be 'repointed' to a new physical file sytem object by invoking this method.
Show Details1.0no

Parameters
Arrayaset of arguments

Returns
Stringthe file extension of the referenced filesystem object

Throws
Throws a Exception containing the error code.
move(String destination) : void
Move the referenced file to a new filesystem location provided as a parameter NOTE: after a move, 'this' will be reinitialized to reference the moved file!
Show Details1.0no

Parameters
Stringdestinationpath

Throws
Throws a Exception containing the error code.
normalize() : void
As of Mozilla 1.7, the underlying XPCOM method is only implemented under UNIX builds (except for Mac OSX). This method will fail if the path does not exist.
Show Details1.0no
Throws
Throws a Exception containing the error code.
resetCache() : Boolean
Truncates the file referenced by the filesystem object.
Show Details1.0no

Returns
Booleantrue indicates success

Throws
Throws a Exception containing the error code.
aptana_docs