local-credentials
Read and write credentials in a standardised way
Last updated 3 years ago by mheap .
Original npm · Tarball · package.json
$ cnpm install local-credentials 
SYNC missed versions from official npm registry.

local-credentials

Read data out of an ini formatted ~/.local/credentials file e.g. ~/.aws/credentials

Build Status

Example Usage

You can use this library with either a Promise or a Callback based interface

async/await

async function main() {
    try {
        let Credentials = require("local-credentials");

        const c = new Credentials("~/.basic/credentials");
        const defaultData = await c.get(); // Returns the "default" section
        const specialData = await c.get("special"); // Returns the "special" section

        console.log(defaultData);
        console.log(specialData);
    } catch (err) {
        console.log(err);
    }
}

main();

Callback

let Credentials = require("local-credentials");

const c = new Credentials("~/.basic/credentials");
const defaultData = c.get("default", function(err, data){
    if (err){
        // Do something
    }
    console.log(data);
});

Current Tags

  • 0.0.2                                ...           latest (3 years ago)

2 Versions

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

Copyright 2014 - 2016 © taobao.org |