# appdirectory

> A cross-platform utility to find the best directory to put data and config files.

Latest version **0.1.0** (published 2014-03-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install appdirectory
pnpm add appdirectory
yarn add appdirectory
bun add appdirectory
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-03-11 |
| First published | 2014-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Johz |
| Maintainers | mrjohz |
| Keywords | cross-platform, utility, appdata, config, directory |

## Links

- npm: https://www.npmjs.com/package/appdirectory
- Repository: http://github.com/MrJohz/appdirectory
- Homepage: https://github.com/MrJohz/appdirectory
- Issues: https://github.com/MrJohz/appdirectory/issues
- npm.io page: https://npm.io/package/appdirectory

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-03-11
- 0.0.1 — 2014-03-11

## README

[![Build Status](https://travis-ci.org/MrJohz/appdirectory.png?branch=master)](https://travis-ci.org/MrJohz/appdirectory)
[![Coverage Status](https://coveralls.io/repos/MrJohz/appdirectory/badge.png)](https://coveralls.io/r/MrJohz/appdirectory)

# AppDirectory

AppDirectory is a port of Python's [appdirs][] module.  It can be used as a small cross-platform tool to find the correct directory for an application to use for persistence.  It isn't perfect, but it might be useful.

### Usage
AppDirectory offers one export: the `AppDirectory` constructor:

```
var AppDirectory = require('appdirectory')
var dirs = new AppDirectory('mycoolappname')
```

`AppDirectory` can be instantiated either with a single string (the application's name) or an object containing more information about the application.

```
var dirs = new AppDirectory({
    appName: "mycoolapp", // the app's name, kinda self-explanatory
    appAuthor: "Superman", // The author's name, or (more likely) the name of the company/organisation producing this software.
                           // Only used on Windows, if omitted will default to appName.
    appVersion: "v6000", // The version, will be appended to certain dirs to allow for distinction between versions.
                         // If it isn't present, no version parameter will appear in the paths
    useRoaming: true, // Should AppDirectory use Window's roaming directories?  (Defaults to false)
    platform: "darwin" // You should almost never need to use this, it will be automatically determined
})
```

Now to get some actual paths.

```
dirs.userData() // e.g. /home/awesomeuser/Library/Application Support/mycoolapp on Macs
dirs.userConfig() // e.g. /home/awesomeuser/.config/mycoolapp on linux etc.
dirs.userCache() // e.g. C:\Users\awesomeuser\AppData\Local\mycoolapp\mycoolapp\Cache on Windows 7 (and Vista, I believe)
dirs.userLogs() // e.g. /home/awesomeuser/.cache/mycoolapp/log
```

That's pretty much all there is to it.


### Todo
- Fix site* functions
- Test all user* functions

### Known Limitations
> Note: All this limitations have been fixed by virtue of removing the site* functions.  The aim is to add them back in, at which point they will still exist, as one's a design decision, and the other's unfixable as far as I can tell.  However, at this point, there are no known limitations to AppDirectory!  (Feel free to tell me about new limitations by filing an issue.)
- ~~On Windows Vista, the site-config and site-data directories are hidden system directories, which may cause issues.  I don't have a copy of Vista to hand to play around with how well this works, though, so YMMV.~~
- ~~On unix-likes (including those with XDG-compliance), requesting the site-config and site-data directories will return just one directory, even in cases where the XDG* variables contain more than one individual path.  (Specifically, it will be the first path AppDirectory finds.)~~

[appdirs]: <https://pypi.python.org/pypi/appdirs/>

---
_Source: https://npm.io/package/appdirectory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
