env-paths
Get paths for storing things like data, config, cache, etc
Last updated a year ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install env-paths 
SYNC missed versions from official npm registry.

env-paths Build Status

Get paths for storing things like data, config, cache, etc

Uses the correct OS-specific paths. Most developers get this wrong.

Install

$ npm install env-paths

Usage

const envPaths = require('env-paths');

const paths = envPaths('MyApp');

paths.data;
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'

paths.config
//=> '/home/sindresorhus/.config/MyApp-nodejs'

API

paths = envPaths(name, [options])

name

Type: string

Name of your project. Used to generate the paths.

options

Type: Object

suffix

Type: string
Default: 'nodejs'

Don't use this option unless you really have to!
Suffix appended to the project name to avoid name conflicts with native apps. Pass an empty string to disable it.

paths.data

Directory for data files.

paths.config

Directory for config files.

paths.cache

Directory for non-essential data files.

paths.log

Directory for log files.

paths.temp

Directory for temporary files.

License

MIT © Sindre Sorhus

Current Tags

  • 2.2.0                                ...           latest (a year ago)

8 Versions

  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 157
This Week 3,541
This Month 37,781
Last Day 3,384
Last Week 21,107
Last Month 84,614
Dependencies (0)
None
Dev Dependencies (3)
Dependents (214)

Copyright 2014 - 2016 © taobao.org |