Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cachedir

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachedir - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

24

index.js
var os = require('os');
var env = process.env;
var impl = null;
var implementation;
switch(os.type()) {
case 'Darwin':
impl = function (id) {
implementation = function (id) {
return env.HOME + '/Library/Caches/' + id;

@@ -13,3 +14,3 @@ };

case 'Linux':
impl = function (id) {
implementation = function (id) {
return env.HOME + '/.cache/' + id;

@@ -22,13 +23,14 @@ };

module.exports = exports = function (id) {
if(typeof(id) != 'string') {
throw new Error('Argument id should be a string');
module.exports = function (id) {
if(typeof id !== 'string') {
throw new TypeError('id is not a string');
}
if(id.length == 0) {
throw new Error('Argument id cannot be empty');
if(id.length === 0) {
throw new Error('id cannot be empty');
}
if(/[ \n\r\t]/.test(id)) {
throw new Error('Argument id cannot contain spaces');
if(/[^0-9a-zA-Z-]/.test(id)) {
throw new Error('id cannot contain special characters');
}
return impl(id);
return implementation(id);
};
{
"name": "cachedir",
"version": "0.1.0",
"main": "index.js"
"version": "0.1.1",
"license": "MIT",
"author": "Linus Unnebäck <linus@folkdatorn.se>",
"main": "index.js",
"repository": {
"type": "git",
"url": "http://github.com/LinusU/node-cachedir.git"
}
}

@@ -1,4 +0,19 @@

node-cachedir
=============
# node-cachedir
Get a directory for your caching needs
Provides a directory where the OS wants you to store cached files.
## Installation
```sh
npm install cachedir
```
## Usage
```javascript
var cachedir = require('cachedir');
var path = cachedir('linusu');
// `dir` now contains the path under which you should store cached files
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc