Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-dotconfig

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-dotconfig

Easily store and manage config files for your CLI

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

node-dotconfig

npm version Build Status codecov

Easily create and read config files from the user's home directory.

  • 🐝 Config files saved in ini format
  • 🏆 Cross-platform support for Windows, Linux and macOS.
  • 💥 Typings readily available
  • 🏄‍♂️ Promise-based API
  • 🥑 Proper support for nested config objects

Read the docs.

Motivation

This utility is useful when you want to save .my-app config files in the user's home directory. CLIs are well known to use this technique for saving user's preferences.

Installation

npm i node-dotconfig

Usage

import { createConfig, readConfig } from 'node-dotconfig';

async function config() {
  await createConfig('.my-cli', { user: { name: 'johndoe', apiKey: '12345' } });
  const config = await readConfig('.my-cli');
  console.log(config.user.name); // 'johndoe'
}

Running the code above will create the file ~/.my-cli with the following content:

[user]
name=johndoe
apiKey=12345

API

Licence

MIT © Carlos Roso

FAQs

Package last updated on 28 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc