API
Run a task
Parameters
-
string
task
: The task name -
array
args
: The task's arguments. Must be an array -
object
context
: [Optionnal] Thethis
object of the task
Select files to works on.
Parameters
-
string
selector
: Must be a Glob pattern.
Returns Wesyer.Files
Create a file to works on.
Parameters
-
string
input
: The file path -
string
match
: The glob pattern used to find the file (this can be the file path) -
string
encoding
: The file encoding. If omitted, this will be the encoding defined in the configuration
Returns The path of the file
Returns The encoding used to open the file
Returns The base name of the file (after all slaches, such as example.txt
)
Returns The glob pattern used to find the file
Pipe the file with a module
Parameters
-
string
module
: The module's name
Apply a callback to the file's content
Parameters
-
function callback
: The callback function. It must accept one parameter : the file's content (string)
Returns The content returned by the callback
Apply a callback to the file's content. The result of the callback is stored as the file's content.
Parameters
-
function callback
: The callback function. It must accept one parameter : the file's content (string)
Returns false if an error occured.
Write the content of the file in an other folder
Parameters
-
string
output
: The output file path -
object
options
: [Optionnal] Can containsencoding
androot
parameters. Ifroot
is not null and not false, it will write the file at the root of the folder
Select files to works on.
Parameters
-
string
from
: A glob pattern to select files -
string
encoding
: The encoding of the files. If omitted, this will be replaced by the encoding defined in the configuration
Returns The glob pattern used to select files
Returns The files' encoding
Pipe all files with a module
Parameters
-
string
module
: The module name
Call the apply
function of each file with callback
as parameter
Parameters Parameters of Wesyer.File.apply
Call the out
function of each file with output
and options
as parameters.
Parameters Parameters of Wesyer.File.out