npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@anujdatar/appconfig

v2.2.0

Published

persistent storage of node app configurations

Downloads

29

Readme

appconfig

Module for persistant configuration storage for node apps. This module is a simpler version of conf, but is heavily based on it. Avoids use of write-file-atomic and make-dir because of chown permission errors with Snaps under strict confinement. Also, written in ES6.

Usage

Install package

npm i @anujdatar/appconfig

For beta/dev branch of package, if a newer test version exists

npm i @anujdatar/appconfig@next

Basic usage

const appConfig = require('@anujdatar/appconfig')

const config = new appConfig()

config.set(key, value) // adds { key: value } to the store

config.get(key) // returns value

config.delete(key) // removes { key: value } from store

Other options

  1. Using defaults

    const appConfig = require('@anujdatar/appconfig')
    
    const appDefaults = {
      'foo': 'abcd',
      'bar': 'pqrs'
    }
    
    const config = new appConfig({ defaults: appDefaults })
    
    console.log(config.get('foo'))  // abcd
    
    config.set('bar', 'wxyz')
    console.log(config.get('bar'))  // wxyz
    
    // resetting configs
    config.reset('bar')  // for single property
    // or
    config.reset(['foo', 'bar'])  // also accepts a list of properties
    // or reset all props at once
    config.resetAll()
  2. Specify project name explicitly

    const config = new appConfig({ projectName: 'my-project' })
  3. Adding a project suffix, if you have multiple apps named the same, or if you're creating an unofficial version of an app and want to distinguish between the two.

    • projectSuffix: default is blank
  4. Naming the config file: default filename is config.json

    • configName: default is config
    • configExt: default is .json
  5. Using dot-prop notation

    • accessByDotNotation: default true. If you use nested settings. Can be disabled by setting to false

Contributing

use npm run build to compile index.js in src folder. Output in lib folder. Issues

Related

Deprecated and not required anymore: electron-appconfig persistent app config storage for electron apps. Old package that used the old electron.remote, which is deprecated in the new electron. Makes the app slower, and can be a security concern is used incorrectly.

License

MIT Copyright (c) 2019 Anuj Datar