# config-mancer

> Configuration file utilities

Latest version **0.2.1** (published 2013-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install config-mancer
pnpm add config-mancer
yarn add config-mancer
bun add config-mancer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2013-05-31 |
| First published | 2013-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Pablo Kaniefsky |
| Maintainers | jpka |
| Keywords | json, object, configuration, modify, stream |

## Links

- npm: https://www.npmjs.com/package/config-mancer
- Repository: https://github.com/jpka/node-config-mancer
- npm.io page: https://npm.io/package/config-mancer

## Dependencies (3)

- [esprima](https://npm.io/package/esprima.md) ~1.0.3
- [readable-stream](https://npm.io/package/readable-stream.md) ~1.0.2
- [stringify-object](https://npm.io/package/stringify-object.md) ~0.1.3

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.1 (latest) — 2013-05-31
- 0.1.1 — 2013-05-31
- 0.0.1 — 2013-05-31

## README

Node utility intended to work with config files, but it could have other uses.
It works with the first object expression it finds.

#API

### get(filePath, function(err, config, data) {})

gets the config as an object along with some other data

### modify(filePath, function(err, config, save = function(config, callback)) {})

gets the config as an object along with an async save callback

### getAsStream(filePath [, subObject])

returns the config as a write stream ([streams2](http://blog.nodejs.org/2012/12/20/streams2/) supported).
It will get the config, modify it and save it to filesystem once end() is called.

subObject is optional and indicates the subobject you will be writing to, defaults to the root, see below for example.

#Usage

```javascript
require("config-mancer").modify("scripts/rjs-config.js", function(err, config, save) {
  config.paths.jquery = "vendor/jquery.js";
  save(config, function(err) {
    // file saved
  });
});
```

```javascript
var config = require("config-mancer").getAsStream("scripts/rjs-config.js", "paths")
config.write(["jquery", "vendor/jquery.js"]); // will write to paths.jquery
config.on("fileWritten", function(err) {
  // file saved
});
```

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