replacefile
-----------

[![npm version](https://badge.fury.io/js/replacefile.svg)](http://badge.fury.io/js/replacefile)
[![dependencies](https://david-dm.org/jviotti/replacefile.png)](https://david-dm.org/jviotti/replacefile.png)
[![Build Status](https://travis-ci.org/jviotti/replacefile.svg?branch=master)](https://travis-ci.org/jviotti/replacefile)
[![Build status](https://ci.appveyor.com/api/projects/status/quptqasj049qbx87?svg=true)](https://ci.appveyor.com/project/jviotti/replacefile)

Find and replace text in a file.

Installation
------------

Install `replacefile` by running:

```sh
$ npm install --save replacefile
```

Documentation
-------------

<a name="module_replacefile.replace"></a>
### replacefile.replace(file, regex, replacement) ⇒ <code>Promise</code>
**Kind**: static method of <code>[replacefile](#module_replacefile)</code>  
**Summary**: Replace the contents of a file  
**Access:** public  

| Param | Type | Description |
| --- | --- | --- |
| file | <code>String</code> | file path |
| regex | <code>RegExp</code> | regex |
| replacement | <code>String</code> | replacement |

**Example**  
```js
replacefile.replace('foo/bar/config.txt', /^GPUMEM.*$/g, 'GPUMEM=128')
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/jviotti/replacefile/issues/new) on GitHub and the Resin.io team will be happy to help.

Tests
-----

Run the test suite by doing:

```sh
$ gulp test
```

Contribute
----------

- Issue Tracker: [github.com/jviotti/replacefile/issues](https://github.com/jviotti/replacefile/issues)
- Source Code: [github.com/jviotti/replacefile](https://github.com/jviotti/replacefile)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ gulp lint
```

License
-------

The project is licensed under the MIT license.
