netrc

Parse netrc files

netrc

Parse netrc files

var netrc = require('netrc');
 
var myNetrc = netrc();
 
console.log(myNetrc['github.com'])
// { login: 'my-oauth-token', 
//   password: 'x-oauth-basic' } 
 
myNetrc['github.com'].login = 'my-new-oauth-token';
 
netrc.save(myNetrc);

Loads a .netrc file, defaulting to ~/.netrc

Parses netrc formatted string into an object:

{
  "machine1.example.com": {
    "login": "my-login",
    "password": "my-password"
  },
  "machine2.example.com": {
    "login": "my-other-login",
    "password": "my-other-password"
  }
}

Formats a netrc object into a valid string

Persists a netrc object to ~/.netrc

$ npm test