# file-ez

> A simple async wrapper around fs

Latest version **1.0.2** (published 2023-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-ez
pnpm add file-ez
yarn add file-ez
bun add file-ez
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-04-02 |
| First published | 2021-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AroLeaf |
| Maintainers | aroleaf |
| Keywords | fs, files, filesystem |

## Links

- npm: https://www.npmjs.com/package/file-ez
- npm.io page: https://npm.io/package/file-ez

## Dependencies (1)

- [caller](https://npm.io/package/caller.md) ^1.1.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-04-02
- 1.0.1 — 2022-08-21
- 1.0.0 — 2022-02-26
- 0.2.2 — 2021-11-02
- 0.2.0 — 2021-10-24
- 0.1.6 — 2021-05-31
- 0.1.5 — 2021-05-31
- 0.1.4 — 2021-05-25
- 0.1.3 — 2021-05-20
- 0.1.2 — 2021-05-20
- 0.1.1 — 2021-05-20

## README

# F-ez

easy file stuff I suppose

## Install

```sh
npm i file-ez
```

## Usage

f-ez supports commonjs:
```js
const fz = require('file-ez');

fz.res('./file.txt');
```

but also exports everything separately for esm:
```js
import { res } from 'file-ez';

res('./file.txt');
```

## Documentation

### `res(path: string): string`
Resolves a path relative to the file it's called in.\
`path`: an absolute path, or path relative to the current file

### `async recursive(path: string): Promise<string[]>`
Recursively gathers all files in a directory and its subdirectories.\
`path`: an absolute path, or path relative to the current file

### `async require(path: string, full = false): Promise<any>`
Makes `import()` feel more like `require()`, allows mixing esm and commonjs.\
`path`: an absolute path, path relative to the current file, or name of an installed package\
`full`: return the entire module instead of only default

### `async read(path: string): Promise<string>`
Returns the contents of a file as a string.\
`path`: an absolute path, or path relative to the current file

### `async buffer(path: string): Promise<Buffer>`
Returns the contents of a file as a buffer.\
`path`: an absolute path, or path relative to the current file

### `async write(path: string, data: Buffer|string): Promise<undefined>`
Writes data to a file.\
`path`: an absolute path, or path relative to the current file\
`data`: what you want to write to the file

---
_Source: https://npm.io/package/file-ez · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
