https://github.com/justjavac/deno_public_dir
Returns the path to the user's public directory.
https://github.com/justjavac/deno_public_dir
deno deno-module dir path system
Last synced: 4 months ago
JSON representation
Returns the path to the user's public directory.
- Host: GitHub
- URL: https://github.com/justjavac/deno_public_dir
- Owner: justjavac
- License: mit
- Created: 2020-08-19T15:08:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-19T15:12:59.000Z (almost 5 years ago)
- Last Synced: 2025-03-06T07:48:30.794Z (4 months ago)
- Topics: deno, deno-module, dir, path, system
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# deno_public_dir
[](https://github.com/justjavac/deno_public_dir/releases)
[](https://github.com/justjavac/deno_public_dir/actions)
[](https://github.com/justjavac/deno_public_dir/blob/master/LICENSE)
[](https://github.com/denoland/deno)Returns the path to the user's public directory.
The returned value depends on the operating system and is either a string,
containing a value from the following table, or `null`.|Platform | Value | Example |
| ------- | --------------------- | ----------------------- |
| Linux | `XDG_PUBLICSHARE_DIR` | /home/justjavac/Public |
| macOS | `$HOME`/Public | /Users/justjavac/Public |
| Windows | `{FOLDERID_Public}` | C:\Users\Public |## Usage
Requires `allow-env` permission.
Returns `null` if there is no applicable directory or if any other error occurs.
```ts
import publicDir from "https://deno.land/x/public_dir/mod.ts";publicDir();
// Lin: "/home/justjavac/Public"
// Mac: "/Users/justjavac/Public"
// Win: "C:\Users\Public"
```## License
[deno_public_dir](https://github.com/justjavac/deno_public_dir) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.