1 | netrc [![Build Status](https://travis-ci.org/camshaft/netrc.png?branch=master)](https://travis-ci.org/camshaft/netrc)
|
2 | =====
|
3 |
|
4 | Parse netrc files
|
5 |
|
6 | Usage
|
7 | -----
|
8 |
|
9 | ```js
|
10 | var netrc = require('netrc');
|
11 |
|
12 | var myNetrc = netrc();
|
13 |
|
14 | console.log(myNetrc['github.com'])
|
15 | // { login: 'my-oauth-token',
|
16 | // password: 'x-oauth-basic' }
|
17 |
|
18 | myNetrc['github.com'].login = 'my-new-oauth-token';
|
19 |
|
20 | netrc.save(myNetrc);
|
21 | ```
|
22 |
|
23 | API
|
24 | ---
|
25 |
|
26 | ### netrc([file])
|
27 |
|
28 | Loads a `.netrc` file, defaulting to `~/.netrc`
|
29 |
|
30 | ### netrc.parse(string)
|
31 |
|
32 | Parses netrc formatted string into an object:
|
33 |
|
34 | ```json
|
35 | {
|
36 | "machine1.example.com": {
|
37 | "login": "my-login",
|
38 | "password": "my-password"
|
39 | },
|
40 | "machine2.example.com": {
|
41 | "login": "my-other-login",
|
42 | "password": "my-other-password"
|
43 | }
|
44 | }
|
45 | ```
|
46 |
|
47 | ### netrc.format(object)
|
48 |
|
49 | Formats a netrc object into a valid string
|
50 |
|
51 | ### netrc.save(object)
|
52 |
|
53 | Persists a netrc object to `~/.netrc`
|
54 |
|
55 | ## Tests
|
56 |
|
57 | ```
|
58 | $ npm test
|
59 | ```
|