Version: v0.8.0 - Beta.  We welcome contributors & feedback.

File

Methods for working with the filesystem, via file and dir TypeStrings.

$lines = file'files:data.txt'.read()

$files = dir'files:images'.readDir()

Paths

You can prefix a path with a root key to define the base directory path.

Root Key Description
app: Your app’s root directory
files: Same as app:data/files
public: The webserver document root (Default: app:/code/public)
home: User account’s home directory (equivalent to ~)
file'files:/dictionary.txt'
//= Ex: '/path/to/yourApp/data/files/dictionary.txt'

dir'files:/public:/images'
//= Ex: '/path/to/yourApp/code/public/images'

Paths Defined in Configuration

Within .jcon files, keys that are suffixed with Dir or File will automatically be cast to that kind of TypeString.

// file: config/app.jcon

app: {
    logDir: /path/to/logs
    dataFile: /path/to/data.txt
}

// ... in your code ...

AppConfig.get('logDir')
//= dir'/path/to/logs'

AppConfig.get('dataFile')
//= file'/path/to/data.txt'

Methods

Path

Read

Write

Copy/Move/Delete

Info

Directories

MIME Types