Browse files

  • Loading branch information...
0 parents commit 0dad382efb3c9f96e8d7d75778b4cfc674a28926 @isaacs isaacs committed Aug 15, 2012
Showing with 33 additions and 0 deletions.
  1. +33 −0
@@ -0,0 +1,33 @@
+# npmconf
+The config thing npm uses
+If you are interested in interacting with the config settings that npm
+uses, then use this module.
+However, if you are writing a new Node.js program, and want
+configuration functionality similar to what npm has, but for your
+own thing, then I'd recommend using [rc](,
+which is probably what you want.
+If I were to do it all over again, that's what I'd do for npm. But,
+alas, there are many systems depending on many of the particulars of
+npm's configuration setup, so it's not worth the cost of changing.
+var npmconf = require('npmconf')
+// pass in the cli options that you read from the cli
+// or whatever top-level configs you want npm to use for now.
+npmconf.load({some:'configs'}, function (er, conf) {
+ // do stuff with conf
+ conf.get('some', 'cli') // 'configs'
+ conf.get('username') // 'joebobwhatevers'
+ conf.set('foo', 'bar', 'user')
+'user', function (er) {
+ // foo = bar is now saved to ~/.npmrc or wherever
+ })

0 comments on commit 0dad382

Please sign in to comment.