# platform-folders

> Module to get platform dependent folders (e.g. documents, downloads, config)

Latest version **0.6.1** (published 2025-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install platform-folders
pnpm add platform-folders
yarn add platform-folders
bun add platform-folders
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.1 |
| Published | 2025-09-04 |
| First published | 2017-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^8.16.0 \|\| >=10 |
| Dependencies | 1 |
| Unpacked size | 42.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Jan Beckmann |
| Maintainers | kingjan1999 |
| Keywords | platform, folders, documents, downloads, special folders, appdata, platform folders |

## Links

- npm: https://www.npmjs.com/package/platform-folders
- Repository: https://github.com/kingjan1999/platform-folders
- Homepage: https://github.com/kingjan1999/platform-folders#readme
- Issues: https://github.com/kingjan1999/platform-folders/issues
- npm.io page: https://npm.io/package/platform-folders

## Dependencies (1)

- [bindings](https://npm.io/package/bindings.md) ^1.5.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.6.1 (latest) — 2025-09-04
- 0.6.0 — 2022-04-13
- 0.5.4 — 2021-06-20
- 0.5.3 — 2021-04-02
- 0.5.2 — 2020-10-25
- 0.5.1 — 2020-03-18
- 0.5.0 — 2020-03-18
- 0.4.1 — 2019-07-17
- 0.4.0 — 2019-02-24
- 0.3.2 — 2019-02-02
- 0.3.1 — 2019-02-02
- 0.2.7 — 2018-08-05
- 0.2.6 — 2018-06-21
- 0.2.5 — 2018-06-20
- 0.2.4 — 2018-04-25
- … 9 more at https://npm.io/package/platform-folders/versions

## README

# platform-folders
Node.js bindings for [sago007/PlatformFolders](https://github.com/sago007/PlatformFolders) (requires Node.js 8 or 10+)

This library is inspired by Electrons [app.getPath](https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname) used for getting so called "special directories".
These directories, like "Documents", "Downloads" and "AppData" are platform dependent. This Node Native Addon uses a C++ libary (linked above) to resolve the paths on Windows, "Linux" and Mac OS X.

## Usage
You can either use the "Electron-Style" by calling the default export:
```javascript
import getPath from 'platform-folders';
console.log(getPath('downloads'));
```
Following names are supported:
- `home` Home folder (e.g. `/home/<Username>`, `c:\Users\<Username>`, `/Users/<Username>`)
- `appData` Per-User Application Directory (e.g. `/home/<Username>/.local/share`, `c:\Users\<Username>\AppData\Roaming`, `/Users/<Username>/Library/Application Support`)
- `userData` Directory for storing config files (e.g. `/home/<Username>/.config`, `c:\Users\<Username>\AppData\Roaming`, `/Users/<Username>/Library/Application Support`)
- `desktop` Desktop directory (e.g. `/home/<Username>/Schreibtisch` (on a German system), `c:\Users\<Username>\Desktop`, `/Users/<Username>/Desktop`)
- `documents` Documents directory (e.g. `/home/<Username>/Dokumente` (on a German system), `c:\Users\<Username>\Documents`, `/Users/<Username>/Documents`)
- `Downloads` Downloads directory (e.g. `/home/<Username>/Downloads`, `c:\Users\<Username>\Downloads`, `/Users/<Username>/Downloads`)
- `music` Music directory (e.g. `/home/<Username>/Musik` (on a German system), `c:\Users\<Username>\Music`, `/Users/<Username>/Music`)
- `pictures` Pictures directory (e.g. `/home/<Username>/Bilder` (on a German system), `c:\Users\<Username>\Pictures`, `/Users/<Username>/Pictures`)
- `videos` Videos directory (e.g. `/home/<Username>/Videos`, `c:\Users\<Username>\Videos`, `/Users/<Username>/Videos`)
- `cache` Cache directory (e.g. `/home/<Username>/.cache`, `c:\Users\<Username>\AppData\Local`, `/Users/<Username>/Library/Caches`)
- `state` State directory (e.g. `/home/<Username>/.local/state`, `c:\Users\<Username>\AppData\Local`, `/Users/<Username>/Library/Application Support`)
- `savegames` Directory for savegames (e.g. `/home/<Username>/.local/share`, `c:\Users\<Username>\SavedGames`, `/Users/<Username>/Library/Application Support`)

Alternatively you can use the named exports:
```javascript
import {getDownloadsFolder} from 'platform-folders';
console.log(getDownloadsFolder());
```

| Key         | Method               |
|-------------|----------------------|
| `home`      | getHomeFolder()      |
| `appData`   | getDataHome()        |
| `appdata`   | getDataHome()        |
| `userData`  | getConfigHome()      |
| `desktop`   | getDesktopFolder()   |
| `documents` | getDocumentsFolder() |
| `downloads` | getDownloadsFolder() |
| `music`     | getMusicFolder()     |
| `pictures`  | getPicturesFolder()  |
| `videos`    | getVideosFolder()    |
| `cache`     | getCacheFolder()     |
| `state`     | getStateFolder()     |
| `savegames` | getSaveGamesFolder() |

Following paths can not be used with `getPath` (as they return arrays), but can be called using the exported function:

- `getDataFolders` Additional global data folders (e.g. `C:\ProgramData`, `/usr/share/`)
- `getConfigFolders` Additional global data folders (e.g. `C:\ProgramData`, `/etc/xdg/`)

These functions are not supported for OS X (they will return an empty array).

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