# fast-files

> ### JSON

Latest version **1.0.9** (published 2021-06-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install fast-files
pnpm add fast-files
yarn add fast-files
bun add fast-files
```

## 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 | 1.0.9 |
| Published | 2021-06-16 |
| First published | 2021-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 37.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Devin.Zhu |
| Maintainers | chooin |

## Links

- npm: https://www.npmjs.com/package/fast-files
- Repository: https://github.com/chooin/fast-files
- Homepage: https://github.com/chooin/fast-files#readme
- Issues: https://github.com/chooin/fast-files/issues
- npm.io page: https://npm.io/package/fast-files

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [gogocode](https://npm.io/package/gogocode.md) ^0.2.26

## Recent versions

- 1.0.9 (latest) — 2021-06-16
- 1.0.8 — 2021-06-16
- 1.0.7 — 2021-06-16
- 1.0.6 — 2021-05-17
- 1.0.5 — 2021-05-17
- 1.0.4 — 2021-05-13
- 1.0.3 — 2021-05-13
- 1.0.2 — 2021-05-13
- 1.0.1 — 2021-05-12
- 1.0.0 — 2021-05-12

## README

# fast-files

### JSON

##### Parse JSON files

```js
import path from 'path'
import {json} from 'fast-files'

json().readFile(path.resolve(__dirname, './json.json')).parsed
// {
//   content: 'content'
// }
```

##### Change JSON files

```js
import path from 'path'
import {json} from 'fast-files'

const file = json().readFile(path.resolve(__dirname, './json.json'))
file.set('number', 1024)
file.set('object.number', 2048)
file.parsed
// {
//   number: 1024,
//   object: {
//     number: 2048
//   }
// }
file.merge({
  number: 2048,
  boolean: false
})
file.parsed
// {
//   number: 2048,
//   object: {
//     number: 2048
//   },
//   boolean: false
// }
```

#### Create JSON files

```js
import path from 'path'
import {json} from 'fast-files'

file.set('number', 1024)
file.set('object.number', 2048)
file.parsed
// {
//   number: 1024,
//   object: {
//     number: 2048
//   }
// }
```

#### Save JSON files

```js
import path from 'path'
import {json} from 'fast-files'

json()
  .readFile(path.resolve(__dirname, './json.json'))
  .set('number', 1024)
  .set('object.number', 2048)
  .saveFile(null, {
    override: true,
  })
```

#### Change JS files

```js
import path from 'path';
import {js} from 'fast-files';

js()
  .readFile(path.resolve(__dirname, './js.js'))
  .replace('var a = 1', 'var b = 1')
  .saveFile(null, {
    override: true,
  })
```

#### Get code

```js
import path from 'path';
import {js} from 'fast-files';

const code = js()
  .readFile(path.resolve(__dirname, './js.js'))
  .code()
// var a = 1;
```

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