node-localstorage
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -107,27 +107,26 @@ // Generated by CoffeeScript 1.9.0 | ||
var index, k, stat, _MetaKey, _decodedKey, _i, _keys, _len; | ||
if (fs.existsSync(this.location)) { | ||
if (!fs.statSync(this.location).isDirectory()) { | ||
try { | ||
stat = fs.statSync(this.location); | ||
if ((stat != null) && !stat.isDirectory()) { | ||
throw new Error("A file exists at the location '" + this.location + "' when trying to create/open localStorage"); | ||
} | ||
} | ||
this.bytesInUse = 0; | ||
this.length = 0; | ||
if (!fs.existsSync(this.location)) { | ||
this.bytesInUse = 0; | ||
this.length = 0; | ||
_keys = fs.readdirSync(this.location); | ||
for (index = _i = 0, _len = _keys.length; _i < _len; index = ++_i) { | ||
k = _keys[index]; | ||
_decodedKey = decodeURIComponent(k); | ||
this.keys.push(_decodedKey); | ||
_MetaKey = new MetaKey(k, index); | ||
this.metaKeyMap[_decodedKey] = _MetaKey; | ||
stat = this.getStat(k); | ||
if ((stat != null ? stat.size : void 0) != null) { | ||
_MetaKey.size = stat.size; | ||
this.bytesInUse += stat.size; | ||
} | ||
} | ||
this.length = _keys.length; | ||
} catch (_error) { | ||
fs.mkdirSync(this.location); | ||
return; | ||
} | ||
_keys = fs.readdirSync(this.location); | ||
for (index = _i = 0, _len = _keys.length; _i < _len; index = ++_i) { | ||
k = _keys[index]; | ||
_decodedKey = decodeURIComponent(k); | ||
this.keys.push(_decodedKey); | ||
_MetaKey = new MetaKey(k, index); | ||
this.metaKeyMap[_decodedKey] = _MetaKey; | ||
stat = this.getStat(k); | ||
if ((stat != null ? stat.size : void 0) != null) { | ||
_MetaKey.size = stat.size; | ||
this.bytesInUse += stat.size; | ||
} | ||
} | ||
return this.length = _keys.length; | ||
}; | ||
@@ -187,5 +186,5 @@ | ||
filename = path.join(this.location, encodeURIComponent(key)); | ||
if (fs.existsSync(filename)) { | ||
try { | ||
return fs.statSync(filename); | ||
} else { | ||
} catch (_error) { | ||
return null; | ||
@@ -192,0 +191,0 @@ } |
{ | ||
"name": "node-localstorage", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"main": "./LocalStorage", | ||
@@ -30,3 +30,4 @@ "description": "A drop-in substitute for the browser native localStorage API that runs on node.js.", | ||
"test": "cake test", | ||
"docompile": "cake compile" | ||
"docompile": "cake compile", | ||
"prepublish": "cake compile" | ||
}, | ||
@@ -33,0 +34,0 @@ "licenses": [ |
[![build status](https://secure.travis-ci.org/lmaccherone/node-localstorage.png)](http://travis-ci.org/lmaccherone/node-localstorage) | ||
[![bitHound Score](https://www.bithound.io/github/lmaccherone/node-localstorage/badges/score.svg)](https://www.bithound.io/github/lmaccherone/node-localstorage) | ||
# node-localstorage # | ||
@@ -68,3 +69,4 @@ | ||
* 0.5.2 - 2015-08-01 - Fixed defect where keys were not being updated correctly by removeItem() (thank, ed69140) | ||
* 0.6.0 - 2015-09-11 - Removed references to deprecated fs.existsSync() (thanks, josephbosire) | ||
* 0.5.2 - 2015-08-01 - Fixed defect where keys were not being updated correctly by removeItem() (thanks, ed69140) | ||
* 0.5.1 - 2015-06-01 - Added support for events | ||
@@ -71,0 +73,0 @@ * 0.5.0 - 2015-02-02 - Added JSONStorage class which allows you set and get native JSON |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57360
103
9
242