v1.2.1.0

Description

The FS namespace holds constants related to file system tasks. They are referenced in JavaScript as FS.<constant>, eg. FS.O_RDONLY.

Public Types

enum  OpenModeFlag : uint
 
enum  OpenMode : OpenModeFlag
 
enum  FileTime : int
 
enum  Permission : uint
 
enum  Permissions : Permission
 
enum  FileError : int
 
enum  DirFilter
 
enum  DirFilters : DirFilter
 
enum  DirSort
 
enum  DirSortFlags : DirSort
 

Member Enumeration Documentation

◆ OpenModeFlag

enum OpenModeFlag : uint

File handling mode flags.

See also
OpenMode
Enumerator
O_NOTOPEN 

The file is not open in any mode, or no explicit mode flags are specified.

O_DEFAULT 

Default options for selected operation (depending on method/function being invoked).

O_RDONLY 

Read mode.

Text value: 'r'

O_WRONLY 

Write mode.

Default is usually to truncate/overwrite the destination file. Text value: 'w'

O_RDWR 

Read+Write mode.

Text value: 'rw' or 'r+' or 'w+'

O_APPEND 

Append to file (implies O_WRONLY).

Text value: 'a'

O_TRUNC 

Truncate file (implies O_WRONLY).

Text value: no value, this is the default mode.

O_TEXT 

Handle file in text mode (returns strings instead of bytes, handles Windows line endings).

Text value: 't'

O_BIN 

Handle file in binary mode (returns results as byte arrays).

Text value: 'b'

O_DIRECT 

Open in un-buffered mode.

Text value: 's'

O_EXCL 

Do not overwrite existing file when writing (returns error if file exists).

Text value: 'x'

O_NOCREAT 

Only write to file if it exists (returns error otherwise).

Text value: 'n'

◆ OpenMode

The FS.OpenMode type stores an OR combination of FS.OpenModeFlag values.

◆ FileTime

enum FileTime : int

File date/time enumerations for FileHandle.fileTime() and FileHandle.setFileTime(). The names are meant to follow GNU/POSIX file info stat structure names.

Enumerator
S_ATIME 

Access time.

S_BTIME 

Birth/creation time (may not be available).

S_CTIME 

Attribute/status modification time.

S_MTIME 

File modification time.

◆ Permission

enum Permission : uint

Permission flags returned by permissions() and used with setPermissions(). These conform to GNU/Node/etc file mode constants, with the addition of "OWN" (owner) bits. On NTFS the owner may differ from the user. On Unix/POSIX the "USR" bits return owner information as per convention.

Note
Because of differences in the platforms, the semantics of S_IRUSR, S_IWUSR and S_IXUSR are platform-dependent: On Unix, the rights of the owner of the file are returned and on Windows the rights of the current user are returned.
Enumerator
S_IROWN 

The file is readable by the owner of the file.

S_IWOWN 

The file is writable by the owner of the file.

S_IXOWN 

The file is executable by the owner of the file.

S_IRWXN 

S_IROWN | S_IWOWN | S_IXOWN.

S_IRUSR 

The file is readable by the user.

S_IWUSR 

The file is writable by the user.

S_IXUSR 

The file is executable by the user.

S_IRWXU 

S_IRUSR | S_IWUSR | S_IXUSR.

S_IRGRP 

The file is readable by the group.

S_IWGRP 

The file is writable by the group.

S_IXGRP 

The file is executable by the group.

S_IRWXG 

S_IRGRP | S_IWGRP | S_IXGRP.

S_IROTH 

The file is readable by anyone.

S_IWOTH 

The file is writable by anyone.

S_IXOTH 

The file is executable by anyone.

S_IRWXO 

S_IROTH | S_IWOTH | S_IXOTH.

◆ Permissions

The FS.Permissions type stores an OR combination of FS.Permission values.

◆ FileError

enum FileError : int

Error type enumeration returned by the FileHandle.error() method.

Enumerator
NoError 

No error occurred.

ReadError 

An error occurred when reading from the file.

WriteError 

An error occurred when writing to the file.

FatalError 

A fatal error occurred.

ResourceError 

Out of resources (e.g., too many open files, out of memory, etc.)

OpenError 

The file could not be opened.

AbortError 

The operation was aborted.

TimeOutError 

A timeout occurred.

UnspecifiedError 

An unspecified error occurred.

RemoveError 

The file could not be removed.

RenameError 

The file could not be renamed.

PositionError 

The position in the file could not be changed.

ResizeError 

The file could not be resized.

PermissionsError 

The file could not be accessed.

CopyError 

The file could not be copied.

◆ DirFilter

enum DirFilter

This enum describes the filtering options available for Dir.list() Dir.infoList(). The sort value is specified by OR-ing together values from the following list.

Enumerator
NoFilter 

Do not apply any filtering to the list results.

Dirs 

List directories that match the filters.

Files 

List files.

Drives 

List disk drives (ignored under Unix).

NoSymLinks 

Do not list symbolic links (ignored by operating systems that don't support symbolic links).

AllEntries 

List directories, files, drives and symlinks (this does not list broken symlinks unless you specify System).

Readable 

List files for which the application has read access.

The Readable value needs to be combined with Dirs or Files.

Writable 

List files for which the application has write access.

The Writable value needs to be combined with Dirs or Files.

Executable 

List files for which the application has execute access.

The Executable value needs to be combined with Dirs or Files.

Modified 

Only list files that have been modified (ignored on Unix).

Hidden 

List hidden files (on Unix, files starting with a ".").

System 

List system files (on Unix, FIFOs, sockets and device files are included; on Windows, .lnk files are included)

AllDirs 

List all directories; i.e.

don't apply the filters to directory names.

CaseSensitive 

The filter should be case sensitive.

NoDot 

Do not list the special entry ".".

NoDotDot 

Do not list the special entry "..".

NoDotAndDotDot 

Do not list the special entries "." and "..".

◆ DirFilters

The DirFilters type stores an OR combination of DirFilter values.

◆ DirSort

enum DirSort

This enum describes the sort options available for Dir.list() Dir.infoList(). The sort value is specified by OR-ing together values from the following list. But only one of SortName, SortTime, SortSize or SortType can be specified at a time.
If you specify both SortDirsFirst and SortReversed, directories are still put first, but in reverse order; the files will be listed after the directories, again in reverse order.

Enumerator
SortDefault 

Not sorted by default.

SortName 

Sort by name.

SortTime 

Sort by modification time.

SortSize 

Sort by file size.

SortType 

Sort by file type (extension).

SortUnsorted 

Do not sort.

SortDirsFirst 

Put the directories first, then the files.

SortDirsLast 

Put the files first, then the directories.

SortReversed 

Reverse the sort order.

SortIgnoreCase 

Sort case-insensitively.

SortLocaleAware 

Sort items appropriately using the current locale settings.

◆ DirSortFlags

The DirSortFlags type stores an OR combination of DirSort values.