justo.plugin.fs
v1.0.0-alpha2.1
Published
Plugin for file system commands.
Downloads
1
Readme
justo.plugin.fs
Plugin for file system commands:
- To copy files and directories.
- To move files and directories.
- To remove files and directories.
- To make directories.
- To append content to a file.
- To check whether a path exists.
- To get the entries of a directory.
Developed in Dogma, compiled to JavaScript.
Engineered in Valencia, Spain, EU by Justo Labs.
fs.copy
It copies a file or directory:
fs.copy({src, dst, force})
fs.copy(src, dst, force)
src
(string, required). File/directory to copy.dst
(string, required). Where to copy.force
(bool). Must the file be copied ifdst
exists? Default:false
.
Example:
fs.copy({
src: "/opt/redis/conf/redis.conf",
dst: "/bk/redis/conf/redis.conf",
force: true
})
fs.rm
It removes a file or a directory:
fs.rm({path})
fs.rm(path)
path
(string, required). File to remove.
Example:
fs.rm({
path: "/opt/redis/conf/redis.conf"
})
fs.mkdir
It creates a directory:
fs.mkdir({path})
fs.mkdir(path)
path
(string, required). Directory to create.
Example:
fs.mkdir({
path: "/opt/redis"
})
fs.move
It moves a file or a directory to other path:
fs.move({src, dst, force})
fs.move(src, dst, force)
src
(string, required). Path to move.dst
(string, required). Path where to move.force
(bool). Overwrite ifdst
exists? Default:false
.
fs.append
It appends content to a file:
fs.append({path, data, line})
fs.append(path, data, line)
path
(string, required). File path.data
(string, required). Content to add.line
(number). Line where to insert the data. Negative values allowed.
Example
fs.append({
src: "myfile.txt",
data: "This is the content to append."
})
fs.exists
It checks whether a path exists:
fs.exists({path})
fs.exists(path)
path
(string, required). Entry path.
Example:
fs.exists({
path: "myfile.txt"
})
fs.ls
It returns the directory entries:
fs.ls({name})
fs.ls(name)
name
(string, required). Directory name.