Skip to main content

env-paths

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

Test CI

import envPaths from "https://raw.githubusercontent.com/lemarier/deno-env-paths/master/mod.ts";

const paths = envPaths("MyApp");

console.log(paths.data);
//=> '/Users/david/Library/Application Support/MyApp-deno'

console.log(paths.config);
//=> '/Users/david/Library/Preferences/MyApp-deno'

API

paths = envPaths(name, options?)

Note: It only generates the path strings. It doesn’t create the directories for you.

name

Type: string

Name of your project. Used to generate the paths.

options

Type: object

suffix

Type: string
Default: 'deno'

Don’t use this option unless you really have to!
Suffix appended to the project name to avoid name conflicts with native apps.

paths.data

Directory for data files.

paths.config

Directory for config files.

paths.cache

Directory for non-essential data files.

Directory for log files.

paths.temp

Directory for temporary files.


Inspired by env-paths from sindresorhus.