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 |
Requires allow-env
permission.
Returns null
if there is no applicable directory or if any other error occurs.
import publicDir from "https://deno.land/x/public_dir/mod.ts";
publicDir();
// Lin: "/home/justjavac/Public"
// Mac: "/Users/justjavac/Public"
// Win: "C:\Users\Public"
deno_public_dir is released under the MIT License. See the bundled LICENSE file for details.