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

node-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-localstorage - npm Package Compare versions

Comparing version 3.0.2 to 3.0.4

39

LocalStorage.js

@@ -159,3 +159,3 @@ // Generated by CoffeeScript 2.7.0

_init() {
var _MetaKey, _decodedKey, _keys, e, i, index, k, len, stat;
var e, stat;
try {

@@ -167,18 +167,3 @@ stat = fs.statSync(this._location);

// At this point, it exists and is definitely a directory. So read it.
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;
_sync();
} catch (error) {

@@ -203,2 +188,22 @@ e = error;

_sync() {
var _MetaKey, _decodedKey, _keys, i, index, k, len, stat;
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;
}
}
return this.length = _keys.length;
}
setItem(key, value) {

@@ -205,0 +210,0 @@ var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength;

{
"name": "node-localstorage",
"version": "3.0.2",
"version": "3.0.4",
"main": "./LocalStorage",

@@ -5,0 +5,0 @@ "description": "A drop-in substitute for the browser native localStorage API that runs on node.js.",

@@ -29,5 +29,8 @@ ![CI](https://github.com/lmaccherone/node-localstorage/actions/workflows/master-checks.yml/badge.svg)

* Associative array `localStorage['myKey'] = 'myValue'` and dot property `localStorage.myKey = 'myValue'`
syntax. If you are in an ES6 supported environment.
syntax if you are in an ES6 supported environment.
* Using non-standard `_sync()` files can be re-read from disk. This is useful if you are using more
than one process to access the same storage location.
### Limitations:
* When using Associative array or dot property syntax, you cannot use keys that

@@ -98,2 +101,3 @@ collide with my "private" properties and methods including keys that start

* 3.0.4 - 2023-07-25 - Merged pull request to add `_sync()` method (thanks @NexusNull)
* 3.0.2 - 2023-07-25 - Grrr forgot to update changlelog and package.json before running `npm publish`

@@ -100,0 +104,0 @@ * 3.0.1 - 2023-07-25 - Object.keys(localStorage) now behaves the same as browser closing Issue #27 (thanks @Hotell)

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