Skip to content

Get paths for storing things like data, config, cache, etc with Deno.

Notifications You must be signed in to change notification settings

truestamp/deno-app-paths

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App Paths

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.

API

appPaths(appName: string): Paths

interface Paths
  cache: string
  config: string
  data: string
  log: string
  temp: string

Usage

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"

Testing

deno task test

About

Get paths for storing things like data, config, cache, etc with Deno.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%