# replacefile

> Find and replace text in a file

Latest version **1.0.0** (published 2015-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install replacefile
pnpm add replacefile
yarn add replacefile
bun add replacefile
```

## 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.0 |
| Published | 2015-07-14 |
| First published | 2015-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Juan Cruz Viotti |
| Maintainers | jviotti |
| Keywords | replace, file, contents, substitute |

## Links

- npm: https://www.npmjs.com/package/replacefile
- Repository: https://github.com/jviotti/replacefile
- Issues: https://github.com/jviotti/replacefile/issues
- npm.io page: https://npm.io/package/replacefile

## Dependencies (3)

- [tmp](https://npm.io/package/tmp.md) 0.0.26
- [bluebird](https://npm.io/package/bluebird.md) ^2.9.33
- [stream-replace](https://npm.io/package/stream-replace.md) ^1.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-07-14

## README

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.

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