This component implements the following interfaces:


Create Types

NORMAL_FILE_TYPE - A normal file. DIRECTORY_TYPE - A directory/folder.



readonly nsISimpleEnumerator nsIFile.directoryEntries

Returns an enumeration of the elements in a directory. Each element in the enumeration is an nsIFile.

readonly PRInt64 nsILocalFile.diskSpaceAvailable

PRInt64 nsIFile.fileSize

WARNING! On the Mac, getting/setting the file size with nsIFile only deals with the size of the data fork. If you need to know the size of the combined data and resource forks use the GetFileSizeWithResFork() method defined on nsILocalFileMac.

readonly PRInt64 nsIFile.fileSizeOfLink

PRBool nsILocalFile.followLinks


This attribute will determine if the nsLocalFile will auto resolve symbolic links. By default, this value will be false on all non unix systems. On unix, this attribute is effectively a noop.

PRInt64 nsIFile.lastModifiedTime

File Times are to be in milliseconds from midnight (00:00:00), January 1, 1970 Greenwich Mean Time (GMT).

PRInt64 nsIFile.lastModifiedTimeOfLink

AString nsIFile.leafName

Accessor to the leaf name of the file itself. For the nativeLeafName method, the nativeLeafName must be in the native filesystem charset.

ACString nsIFile.nativeLeafName

readonly ACString nsIFile.nativePath

readonly ACString nsIFile.nativeTarget

readonly nsIFile nsIFile.parent

Parent will be null when this is at the top of the volume.

readonly AString nsIFile.path

PRUint32 nsIFile.permissions

Attributes of nsIFile.

PRUint32 nsIFile.permissionsOfLink

ACString nsILocalFile.persistentDescriptor

Accessor to a null terminated string which will specify the file in a persistent manner for disk storage.

The character set of this attribute is undefined. DO NOT TRY TO INTERPRET IT AS HUMAN READABLE TEXT!

readonly AString nsIFile.target

Target & path

Accessor to the string path. The native version of these strings are not guaranteed to be a usable path to pass to NSPR or the C stdlib. There are problems that affect platforms on which a path does not fully specify a file because two volumes can have the same name (e.g., XP_MAC). This is solved by holding "private", native data in the nsIFile implementation. This native data is lost when you convert to a string.


Target Find out what the symlink points at. Will give error (NS_ERROR_FILE_INVALID_PATH) if not a symlink.

Path Find out what the nsIFile points at.

Note that the ACString attributes are returned in the native filesystem charset.


nsIFile void append ( AString node )
nsIFile [noscript] void appendNative ( ACString node )
nsILocalFile [noscript] void appendRelativeNativePath ( ACString relativeFilePath )
nsILocalFile void appendRelativePath ( AString relativeFilePath )
nsIFile nsIFile clone ( )
nsIFile PRBool contains ( nsIFile inFile , PRBool recur )
nsIFile void copyTo ( nsIFile newParentDir , AString newName )
nsIFile void copyToFollowingLinks ( nsIFile newParentDir , AString newName )
nsIFile [noscript] void copyToFollowingLinksNative ( nsIFile newParentDir , ACString newName )
nsIFile [noscript] void CopyToNative ( nsIFile newParentDir , ACString newName )
nsIFile void create ( PRUint32 type , PRUint32 permissions )
nsIFile void createUnique ( PRUint32 type , PRUint32 permissions )
nsIFile PRBool equals ( nsIFile inFile )
nsIFile PRBool exists ( )
nsILocalFile ACString getRelativeDescriptor ( nsILocalFile fromFile )
nsILocalFile void initWithFile ( nsILocalFile file )
nsILocalFile [noscript] void initWithNativePath ( ACString filePath )
nsILocalFile void initWithPath ( AString filePath )
nsIFile PRBool isDirectory ( )
nsIFile PRBool isExecutable ( )
nsIFile PRBool isFile ( )
nsIFile PRBool isHidden ( )
nsIFile PRBool isReadable ( )
nsIFile PRBool isSpecial ( )
nsIFile PRBool isSymlink ( )
nsIFile PRBool isWritable ( )
nsILocalFile void launch ( )
nsILocalFile [noscript] PRLibrary* load ( )
nsIFile void moveTo ( nsIFile newParentDir , AString newName )
nsIFile [noscript] void moveToNative ( nsIFile newParentDir , ACString newName )
nsIFile void normalize ( )
nsILocalFile [noscript] FILE* openANSIFileDesc ( char* mode )
nsILocalFile [noscript] PRFileDesc* openNSPRFileDesc ( PRInt32 flags , PRInt32 mode )
nsIFile void remove ( PRBool recursive )
nsILocalFile void reveal ( )
nsILocalFile void setRelativeDescriptor ( nsILocalFile fromFile , ACString relativeDesc )

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com