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

appdata-path

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appdata-path

Get the AppData path

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
increased by30.28%
Maintainers
1
Weekly downloads
 
Created
Source

AppData Path

Installation

npm install -S appdata-path

Usage

import getAppDataPath from "appdata-path";
// Or
// const getAppDataPath = require("appdata-path");

console.log(getAppDataPath());
/*
 * Linux:
 * "/home/demurgos/.config"
 * 
 * Mac:
 * "/Users/demurgos/Library/Application Support"
 * 
 * Windows:
 * "C:\Users\demurgos\AppData\Roaming"
 * 
 * System with custom `APPDATA` environment variable:
 * process.env["APPDATA"]
 * For example:
 * process.env["APPDATA"] = "/home/demurgos/apps"
 * => "/home/demurgos/apps"
 */

console.log(getAppDataPath("my-app"));
/*
 * Linux:
 * "/home/demurgos/.config/my-app"
 * 
 * Mac:
 * "/Users/demurgos/Library/Application Support/my-app"
 * 
 * Windows:
 * "C:\Users\demurgos\AppData\Roaming\my-app"
 * 
 * System with custom `APPDATA` environment variable:
 * path.join(process.env["APPDATA"], "my-app")
 * or (if `process.env["APPDATA"] === os.homedir()`)
 * path.join(process.env["APPDATA"], ".my-app")
 * For example:
 * process.env["APPDATA"] = "/home/demurgos/apps"
 * => "/home/demurgos/apps/my-app"
 * process.env["APPDATA"] = "/home/demurgos"
 * => "/home/demurgos/.my-app"
 */

API

getAppDataPath(app?: string): string

Returns the absolute system-dependant path for the place where applications should store their data for the current user. If you pass the name of your app directory or file as an argument, it will return the absolute path for the place where you should store the data of your application. It will prefix you file / directory name by a dot if the AppData directory happens to also be the user's home, otherwise it will just use it as is. See the examples above.

Changelog

See CHANGELOG.md.

License

See LICENSE.md.

Keywords

FAQs

Package last updated on 03 Sep 2018

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