
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@dogmalang/fs.async
Advanced tools
API for interacting with the file system, asynchronously.
Developed in Dogma, compiled to JavaScript.
Engineered in Valencia, Spain, EU by DogmaLang.
////////////////
// JavaScript //
////////////////
const fs = require("@dogmalang/fs.async");
#########
# Dogma #
#########
use "@dogmalang/fs.async" as fs
For getting an existent file/dir, use:
////////////////
// JavaScript //
////////////////
fs.entry(...path) : Entry
#########
# Dogma #
#########
fn fs.entry(...path) : Entry
For checking if an entry exists:
////////////////
// JavaScript //
////////////////
async fs.exists(...path) : bool
#########
# Dogma #
#########
async fn fs.exists(...path) : bool
Example:
await(fs.exists("my.txt"))
await(fs.exists("mydir"))
For moving an entry from a location to another:
////////////////
// JavaScript //
////////////////
async fs.mv(src:string, dst:string)
async fs.mv(src:string, dst:string, {overwrite:bool})
#########
# Dogma #
#########
async proc fs.mv(src:text, dst:text)
async proc fs.mv(src:text, dst:text, opts:{overwrite?:bool})
src, the source path.dst, the destination path.overwrite, overwrite if destination existing? Default: true.Example:
await(fs.mv("one.txt", "two.txt"))
For getting a file object:
////////////////
// JavaScript //
////////////////
fs.file(...path) : File
#########
# Dogma #
#########
fn fs.file(...path) : File
If the file doesn't exist, no error raised.
Example:
f = fs.file("mydir", "myfile")
Check whether the file exists:
////////////////
// JavaScript //
////////////////
async exists() : boolean
async fs.isFile(...path) : boolean
#########
# Dogma #
#########
async fn File.exists() : bool
async fn fs.isFile(...path) : bool
Example:
await(fs.file("myfile.txt").exists())
await(fs.isFile("myfile.txt"))
Remove the file:
////////////////
// JavaScript //
////////////////
async rm()
async fs.rm(...path)
#########
# Dogma #
#########
async proc File.rm()
async proc fs.rm(...path)
If the file doesn't exist, no error raised.
Example:
await(fs.file("myfile.txt").rm())
await(fs.rm("myfile.txt"))
Return the size in bytes:
////////////////
// JavaScript //
////////////////
async size() : number
#########
# Dogma #
#########
async fn File.size() : num
Example:
await(fs.file("myfile.txt").size())
Create the file if this doesn't exist:
////////////////
// JavaScript //
////////////////
async ensure()
#########
# Dogma #
#########
async proc File.ensure()
If the file exists, this is not modified.
Example:
await(fs.file("my.txt").ensure())
If the file contains a JSON data, it is returned:
////////////////
// JavaScript //
////////////////
async json() : any
#########
# Dogma #
#########
async fn File.json() : any
Example:
obj = await(fs.file("my.json").json())
Read its content:
////////////////
// JavaScript //
////////////////
async read() : any
async read(encoding:string) : any
async read({encoding}) : any
#########
# Dogma #
#########
async fn File.read() : any
async fn File.read(encoding:text) : any
async fn File.read(opts:{encoding:text}) : any
encoding: utf-8, utf8...Example:
txt = await(fs.file("my.txt").read())
Write its content:
////////////////
// JavaScript //
////////////////
async write(content)
async write(content, encoding:string)
async write(content, {encoding:string})
#########
# Dogma #
#########
async proc File.write(content)
async proc File.write(content, encoding:text)
async proc File.write(content, opts:{encoding:text})
Example:
await(fs.file("my.txt").write("this is the content"))
Append content at the end of the file:
////////////////
// JavaScript //
////////////////
async append(c)
async append(c, encoding:string)
async append(c, {encoding:string})
#########
# Dogma #
#########
async proc File.append(c)
async proc File.append(c, encoding:text)
async proc File.append(c, opts:{encoding:text})
Example:
await(fs.file("my.txt").append("end!"))
Move the file to a new location:
////////////////
// JavaScript //
////////////////
async moveTo(...path)
async fs.move(from:string, to:string)
async fs.move(from:string, to:string, {overwrite:boolean})
#########
# Dogma #
#########
async proc moveTo(...path)
async proc fs.move(from:text, to:text)
async proc fs.move(from:text, to:text, {overwrite:bool})
Example:
await(fs.file("a.txt").moveTo("b.txt"))
await(fs.mv("a.txt", "b.txt"))
For getting a directory object:
////////////////
// JavaScript //
////////////////
fs.dir(...path) : Dir
#########
# Dogma #
#########
fn fs.dir(...path) : Dir
If the directory doesn't exist, no error raised.
Example:
f = fs.dir("my", "dir")
Check whether the directory exists:
////////////////
// JavaScript //
////////////////
async exists() : boolean
async fs.isDir(...path) : boolean
#########
# Dogma #
#########
async fn Dir.exists() : bool
async fn fs.isDir(...path) : bool
Example:
await(fs.dir("my", "dir").exists())
await(fs.isDir("my", "dir"))
Create the directory if this doesn't exist:
////////////////
// JavaScript //
////////////////
async ensure()
#########
# Dogma #
#########
async proc Dir.ensure()
If the directory exists, this is not modified.
Example:
await(fs.dir("mydir").ensure())
Remove the directory:
////////////////
// JavaScript //
////////////////
async rm()
async fs.rm(...path)
#########
# Dogma #
#########
async proc Dir.rm()
async proc fs.rm(...path)
If the directory doesn't exist, no error raised.
Example:
await(fs.dir("my", "dir").rm())
await(fs.rm("my", "dir"))
Return the entries:
////////////////
// JavaScript //
////////////////
async read() : Entry[]
async read({name:string}) : Entry[]
#########
# Dogma #
#########
async fn Dir.read() : list
async fn Dir.read(opts:{name:text}) : list
name. When full, the entry name contains the full name.Example:
entries = await(fs.dir("mydir").read())
Similar to fs.file(dir.path, "file"):
////////////////
// JavaScript //
////////////////
file(...subpath) : File
#########
# Dogma #
#########
fn Dir.file(...subpath) : File
Example:
file = fs.dir("mydir").file("child")
Similar to fs.dir(dir.path, "dir"):
////////////////
// JavaScript //
////////////////
dir(...subpath) : Dir
#########
# Dogma #
#########
fn Dir.dir(...subpath) : Dir
Example:
dir = fs.dir("mydir").dir("child")
FAQs
API for interacting with the file system, asynchronously.
We found that @dogmalang/fs.async demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.