<commit_before># node-fixturify

[![Build Status](https://travis-ci.org/joliss/node-fixturify.png?branch=master)](https://travis-ci.org/joliss/node-fixturify) [![Build status](https://ci.appveyor.com/api/projects/status/yuyrlj8b0ndxohim/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/node-fixturify/branch/master)

Convert JSON objects into directory structures on the file system, and back
again. This package is primarily useful for writing tests.

## Installation

```bash
npm install --save-dev fixturify
```

## Usage

```js
var fs = require('fs')
var fixturify = require('fixturify')

var obj = {
  'foo.txt': 'foo.txt contents',
  'subdir': {
    'bar.txt': 'bar.txt contents'
  }
}

fixturify.writeSync('testdir', obj) // write it to disk

fixturify.readSync('testdir') // => deep-equals obj

fixturify.readSync('testdir', { include: ['foo*'] }) // glob support
// => { foo.txt: 'foo.text contents' }

fixturify.readSync('testdir', { exclude: ['foo*'] }) // glob support
// => { subdir: { bar.txt: 'bar.text contents' } }<commit_msg>update readme to ES6 syntax<commit_after># node-fixturify

[![Build Status](https://travis-ci.org/joliss/node-fixturify.png?branch=master)](https://travis-ci.org/joliss/node-fixturify) [![Build status](https://ci.appveyor.com/api/projects/status/yuyrlj8b0ndxohim/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/node-fixturify/branch/master)

Convert JSON objects into directory structures on the file system, and back
again. This package is primarily useful for writing tests.

## Installation

```bash
yarn add fixturify
```

## Usage

```js
const fs = require('fs')
const fixturify = require('fixturify')

const obj = {
  'foo.txt': 'foo.txt contents',
  'subdir': {
    'bar.txt': 'bar.txt contents'
  }
}

fixturify.writeSync('testdir', obj) // write it to disk

fixturify.readSync('testdir') // => deep-equals obj

fixturify.readSync('testdir', { include: ['foo*'] }) // glob support
// => { foo.txt: 'foo.text contents' }

fixturify.readSync('testdir', { exclude: ['foo*'] }) // glob support
// => { subdir: { bar.txt: 'bar.text contents' } }
{'fraction_non_alphanumeric': 0.1801505174035748, 'fraction_numerical': 0.0023518344308560675, 'mean_word_length': 4.553524804177545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2691077', 'n_tokens_mistral': 779, 'n_tokens_neox': 765, 'n_words': 155}