IO(file, optsopt)
File I/O manager.
Constructor
new IO(file, optsopt)
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file
|
string | File to read/write |
||||||||||||
opts opt
|
object | Options Properties
|
Classes
Methods
read(optsopt) → string
Reads the data from the file.
Parameters:
Name | Type | Description |
---|---|---|
opts opt
|
object | Option to pass to |
Returns:
Data
- Type:
- string
setFile(file) → IO
Sets the file to IO#load
and IO#save
.
Parameters:
Name | Type | Description |
---|---|---|
file
|
string | File path |
Returns:
Itself
- Type:
- IO
write(data, optsopt) → IO
Writes the given data on the file.
If options.backup
is true
, creats a backup before overwrite.
Parameters:
Name | Type | Description |
---|---|---|
data
|
string | Data to write |
opts opt
|
object | Option to pass to |
Returns:
Itself
- Type:
- IO