# @folkforms/file-io

> A few simple file IO functions.

Latest version **0.2.12** (published 2022-01-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @folkforms/file-io
pnpm add @folkforms/file-io
yarn add @folkforms/file-io
bun add @folkforms/file-io
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.12 |
| Published | 2022-01-04 |
| First published | 2021-04-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alan Bergin |
| Maintainers | folkforms |

## Links

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

## Dependencies (5)

- [ignore](https://npm.io/package/ignore.md) ^5.2.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.5
- [untildify](https://npm.io/package/untildify.md) ^4.0.0

## Recent versions

- 0.2.12 (latest) — 2022-01-04
- 0.2.11 — 2022-01-03
- 0.2.10 — 2022-01-03
- 0.2.9 — 2022-01-03
- 0.2.8 — 2021-12-19
- 0.2.7 — 2021-12-04
- 0.2.6 — 2021-11-27
- 0.2.5 — 2021-11-22
- 0.2.4 — 2021-08-03
- 0.2.3 — 2021-07-16
- 0.2.2 — 2021-06-24
- 0.2.1 — 2021-06-07
- 0.2.0 — 2021-06-03
- 0.1.4 — 2021-06-03
- 0.1.3 — 2021-05-31
- … 2 more at https://npm.io/package/@folkforms/file-io/versions

## README

# file-io

A single package for file IO that combines `fs-extra`, `fast-glob`, `untildify` and `ignore`.

- `glob(pattern, options)` - Globs all files according to the given pattern and returns an array of the file paths. This is a thin wrapper around [fast-glob](https://www.npmjs.com/package/fast-glob).
- `ignore(files, rootFolder, ignoreFile)`: Remove files from a list based on the set of ignore files present in `rootFolder` and subfolders
- `readLines(path)` - Reads a text file into an array of lines
- `readLinesAsString(path)` - Reads a text file into a single string
- `readJson(path)` - Reads a text file and parses it as JSON. Equivalent to calling `JSON.parse(readLines(path))`.
- `writeLines(path, array, append = false)` - Writes the given array of lines (joined with `"\n"`) to a file
- `copyFolder(inputFolder, outputFolder, options)` - Copies the given folder recursively, preserving directory structure. Options are the options used when globbing up the input folder. See [fast-glob](https://www.npmjs.com/package/fast-glob) options.
- `exists(path)` - Checks if the given path exists
- `rm_rf(path)` - Removes the given file, or else removes the given folder and its contents recursively
- `mkdir_p(path)` - Creates the given folder and any required intermediate folders
- `cp(src, dest)` - Copies a file to a file or folder

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