A Deno Typescript library for determining operating system
appropriate paths for storing data
, cache
, config
, log
and temp
files
on macOS, Linux, and Windows.
Please note that this library does not create any paths that don't yet exist.
You can make use of the fs
ensureDire
and path join
STDLIB
functions to help you with that.
By convention the appName
namespace you provide should be specified in
reverse domain name notation
to help eliminate conflicts and make it easier to find app specific files.
appPaths(appName: string): Paths
interface Paths
cache: string
config: string
data: string
log: string
temp: string
import { appPaths } from "https://raw.githubusercontent.com/truestamp/deno-app-paths/v1.1.0/mod.ts";
// Specify an app namespace
const paths = appPaths("com.yourorg.yourapp");
console.log(paths);
// paths: {
// cache: "/Users/USERNAME/Library/Caches/com.yourorg.yourapp",
// config: "/Users/USERNAME/Library/Preferences/com.yourorg.yourapp",
// data: "/Users/USERNAME/Library/Application Support/com.yourorg.yourapp",
// log: "/Users/USERNAME/Library/Logs/com.yourorg.yourapp",
// temp: "/var/folders/cg/q568zb_17fv6qx4r2lpl3g0w0000gn/T/com.yourorg.yourapp"
// }
console.log(paths.config);
// "/Users/USERNAME/Library/Preferences/com.yourorg.yourapp"
console.log(paths.data);
// "/Users/USERNAME/Library/Application Support/com.yourorg.yourapp"
deno task test