# @jfonx/file-utils

> Allows you to perform specific operations on files

Latest version **3.0.1** (published 2021-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jfonx/file-utils
pnpm add @jfonx/file-utils
yarn add @jfonx/file-utils
bun add @jfonx/file-utils
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2021-01-11 |
| First published | 2019-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | justkey |

## Links

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

## Dependencies (3)

- [find-up](https://npm.io/package/find-up.md) ^4.1.0
- [comment-json](https://npm.io/package/comment-json.md) ^4.1.0
- [@jfonx/console-utils](https://npm.io/package/@jfonx/console-utils.md) ^1.0.3

## Recent versions

- 3.0.1 (latest) — 2021-01-11
- 3.0.0 — 2021-01-11
- 2.0.2 — 2020-01-16
- 2.0.1 — 2020-01-16
- 2.0.0 — 2020-01-16
- 1.0.0 — 2019-06-03

## README

# file-utils

Allows you to perform specific operations on files

## Installation

```sh
npm install @jfonx/file-utils
```

## Usage

```typescript
import { findUpJsonFile, toObject, writeFile } from '@jfonx/file-utils';

/* Write a file on the disk */
writeFile({
  file: __dirname + '/filename.txt',
  content: 'I am programmer',
  force: true, // Force rewrite if the file exists
});

/* Read the contents of a JSON file and convert it to an object */
toObject(__dirname + '/tsconfig.json', true /* exit program if error */);

/* Looks for a json file recursively back and stops as soon as the file is found or the root of the hard drive is reached*/
const module = findUpJsonFile({
  filename: 'package.json' /* The desired JSON file */,
  isJson: true,
  rootDir: __dirname /* From this folder */,
});
console.log(module);
```

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