https://github.com/strugee/node-cache-or-tmp-directory
Get the cache directory or, failing that, a temporary directory
https://github.com/strugee/node-cache-or-tmp-directory
hacktoberfest javascript nodejs
Last synced: 2 months ago
JSON representation
Get the cache directory or, failing that, a temporary directory
- Host: GitHub
- URL: https://github.com/strugee/node-cache-or-tmp-directory
- Owner: strugee
- License: lgpl-3.0
- Created: 2016-07-22T08:23:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T02:34:45.000Z (over 8 years ago)
- Last Synced: 2025-10-19T01:02:32.966Z (8 months ago)
- Topics: hacktoberfest, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: COPYING
Awesome Lists containing this project
README
# `cache-or-tmp-directory`
Get the cache directory or, failing that, a temporary directory
## Installation
npm install cache-or-tmp-directory
## Usage
`cache-or-tmp-directory` takes one argument, the app name.
```js
var cacheOrTmpDir = require('cache-or-tmp-directory');
console.log(cacheOrTmpDir('myApp'));
```
## Caveats
`cache-or-tmp-directory` won't create the directory for you, just give you a path. You have to create it yourself.
Also, temporary directories are constructed as `$TMPDIR/node-cache-or-tmp-directory/$APPNAME`, where `$TMPDIR` is the operating system's temporary directory and `$APPNAME` is what you passed to the module. An important consequence of this is that there is no random component in the path, as is conventional for temporary stuff. This is because it's assumed you'll use this for caches (duh) so you actually _want_ (say) multiple concurrent processes to get the same path, or two consecutive runs to get the same path and thus share a cache.
See also [`cache-directory`'s caveats][2].
## License
LGPL 3.0+
## Author
AJ Jordan
[1]: https://developer.apple.com/library/prerelease/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1
[2]: https://github.com/strugee/node-cache-directory#caveats