File
A global API that contains features to work with files
This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.
allowed()
Checks if FileAPI can be used for this avatar
allowed()
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
delete()
Deletes file/directory at specified path. Returns true if successful
delete(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
exists()
Checks if file/directory at specified path exists
exists(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
isDirectory()
Checks if specified path is directory
isDirectory(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
isFile()
Checks if specified path is file
isFile(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
isPathAllowed()
Checks if this path is allowed for usage
isPathAllowed(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
list()
Lists all files and directories at specified path, or returns null if directory does not exist or path is not a directory
list(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Table | - | 
Example:
-- example coming soon
mkdir()
Creates a directory at specified path. Returns true if folder was successfully created
mkdir(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
mkdirs()
Creates a directory at specified path including all parent directories. Returns true if folder was successfully created
mkdirs(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| Boolean | - | 
Example:
-- example coming soon
openReadStream()
Opens an input stream for file at specified path
openReadStream(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| InputStream | - | 
Example:
-- example coming soon
openWriteStream()
Opens an output stream for file at specified path
openWriteStream(path)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| OutputStream | - | 
Example:
-- example coming soon
readString()
Reads whole file as string
readString(path, encoding)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
| encoding | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| String | - | 
Example:
-- example coming soon
writeString()
Writes a string to a file
writeString(path, data, encoding)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| path | String | - | - | 
| data | String | - | - | 
| encoding | String | - | - | 
Returns:
| Type | Description | 
|---|---|
| nil | - | 
Example:
-- example coming soon