config-mancer
Configuration file utilities
Last updated 7 years ago by jpka .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install config-mancer 
SYNC missed versions from official npm registry.

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)

returns the config as a write stream (streams2 supported). It will get the config, modify it and save it to filesystem once end() is called.

#Usage

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

Current Tags

  • 0.2.1                                ...           latest (7 years ago)

3 Versions

  • 0.2.1                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (3)

Copyright 2014 - 2017 © taobao.org |