1.0.2 • Published 5 months ago
fs-trusty v1.0.2
fs-trusty
Contents
About
Trusty file reads and writes.
Features
- Works with Atomically
- Respects CommonJS
- All other
fs
functions are accessible
Installation
NPM
npm install fs-trusty
PNPM
pnpm install fs-trusty
Bun
bun add fs-trusty
Deno
deno install npm:fs-trusty
Yarn
yarn add fs-trusty
Documentation
Methods
readFile(path, options?)
Read file asynchronous.
Parameter Description path StringFile to read. options ObjectMethod options. More details returns Promise<String | Buffer>
Example:
await fs.readFile("./config.json");
readFileSync(path, options?)
Read file synchronous.
Parameter Description path StringFile to read. options ObjectMethod options. More details Example:
fs.readFileSync("./config.json");
writeFile(path, data, options?)
Write file asynchronous.
Parameter Description path StringFile to write. data String | BufferData to be written. options ObjectMethod options. More details Example:
await fs.writeFile("./config.json", JSON.stringify({}));
writeFileSync(path, data, options?)
Write file synchronous.
Parameter Description path StringFile to write. data String | BufferData to be written. options ObjectMethod options. More details returns Void
Example:
fs.writeFileSync("./config.json", JSON.stringify({}));