RingoJS

Module ringo/utils/files

A collection of file related utilities not covered by the CommonJS standard fs module.

Functions

Properties

Class PosixPermissions

Instance Methods

Instance Properties


PosixPermissions (permissions)

This class holds POSIX file permissions and can be used to manipulate permissions on POSIX-compatible systems with the Java NIO.2 API.

Parameters

Number|String|java.util.Set<PosixFilePermission> permissions

the POSIX permissions

Returns

PosixPermissions

PosixPermissions.prototype. toJavaFileAttribute ()

Returns a Java file attribute representing the POSIX permissions suitable for NIO.2 methods.

Returns

java.nio.file.attribute.FileAttribute

an object that encapsulates PosixFilePermissions


PosixPermissions.prototype. toJavaPosixFilePermissionSet ()

Returns a set of Java POSIX permissions suitable for NIO.2 methods.

Returns

java.util.Set<PosixFilePermission>

a set of permissions


PosixPermissions.prototype. toString ()


PosixPermissions.prototype. value


createTempFile (prefix, suffix, directory, permissions)

Create a new empty temporary file in the default directory for temporary files.

Parameters

String prefix

the prefix of the temporary file; must be at least three characters long

String suffix

the suffix of the temporary file; may be undefined or null

String directory

optional directory in which to create the file. Omit to use the system's temp file directory.

Number|String|java.util.Set<PosixFilePermission> permissions

optional POSIX permissions to apply

Returns

String

the temporary file's path


isHidden (file)

Tests whether the file represented by this File object is a hidden file. What constitutes a hidden file may depend on the platform we are running on.

Parameters

String file

Returns

Boolean

true if this File object is hidden


resolveId (parent, child)

Resolve path fragment child relative to parent but only if child is a a relative path according to the CommonJS Modules spec, i.e. starts with "." or "..". Otherwise, the child path is returned unchanged.

Parameters

String parent

the parent path

String child

the child path


resolveUri (arbitrary)

Resolve an arbitrary number of path elements relative to each other. This is an adapted version of the file module's resolve function that always and strictly uses forward slashes as file separators. This makes it usable for resolving URI paths as well as module ids and resource paths. Originally adapted for helma/file from narwhal's file module.

Parameters

... arbitrary

number of path elements


roots

An Array containing the system's file system roots. On UNIX platforms this contains a single "/" directory, while on Windows platforms this contains an element for each mounted drive.


separator

The system-dependent file system separator character.


supportsFileAttributeView (attribute)

Checks if the default FileSystem supports the given file attribute view.

Parameters

null attribute

the attribute to check

Returns

boolean

true if the attribute is supported; false otherwise