Module ringo/utils/files
A collection of file related utilities.
Functions
- createTempFile(prefix, suffix, directory)
- isHidden(file)
- resolveId(parent, child)
- resolveUri(arbitrary)
Properties
createTempFile (prefix, suffix, directory)
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. Pass undefined to use the system's default location for temporary files |
Returns
File | the temporary file |
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 | 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.