v1.2.0.1-beta1

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
 

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.