1.0.2 • Published 5 months ago

fs-trusty v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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.

ParameterDescription
pathStringFile to read.
optionsObjectMethod options. More details

returns Promise<String | Buffer>

Example:

await fs.readFile("./config.json");

readFileSync(path, options?)

Read file synchronous.

ParameterDescription
pathStringFile to read.
optionsObjectMethod options. More details

returns String | Buffer

Example:

fs.readFileSync("./config.json");

writeFile(path, data, options?)

Write file asynchronous.

ParameterDescription
pathStringFile to write.
dataString | BufferData to be written.
optionsObjectMethod options. More details

returns Promise<Void>

Example:

await fs.writeFile("./config.json", JSON.stringify({}));

writeFileSync(path, data, options?)

Write file synchronous.

ParameterDescription
pathStringFile to write.
dataString | BufferData to be written.
optionsObjectMethod options. More details

returns Void

Example:

fs.writeFileSync("./config.json", JSON.stringify({}));

Links

License

MIT

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago