New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

diskstore

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diskstore - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

5

History.md
2.0.0 / 2018-03-08
==================
* refactor: use async await
1.0.0 / 2017-10-23

@@ -3,0 +8,0 @@ ==================

24

lib/index.js

@@ -14,3 +14,3 @@ 'use strict';

* disk store
*
*
* @constructor

@@ -34,12 +34,12 @@ * @param {Object} options

* get(relativePath) {
async get(relativePath) {
const filepath = path.join(this.cacheDir, relativePath);
const isExists = yield fs.exists(filepath);
const isExists = await fs.exists(filepath);
if (!isExists) {
return null;
}
return yield fs.readFile(filepath);
return await fs.readFile(filepath);
}
* set(relativePath, data) {
async set(relativePath, data) {
const filepath = path.join(this.cacheDir, relativePath);

@@ -49,12 +49,12 @@ // make sure following operations are atomic

const tmpfile = path.join(this.tmpdir, uuid());
yield [
await Promise.all([
mkdirp(dir),
mkdirp(this.tmpdir),
];
]);
yield fs.writeFile(tmpfile, data);
await fs.writeFile(tmpfile, data);
try {
yield fs.rename(tmpfile, filepath);
await fs.rename(tmpfile, filepath);
} catch (err) {
yield rimraf(tmpfile);
await rimraf(tmpfile);
throw err;

@@ -64,5 +64,5 @@ }

* delete(relativePath) {
async delete(relativePath) {
const filepath = path.join(this.cacheDir, relativePath);
yield fs.unlink(filepath);
await fs.unlink(filepath);
}

@@ -69,0 +69,0 @@ }

{
"name": "diskstore",
"version": "1.0.0",
"version": "2.0.0",
"description": "a local cache implement",

@@ -41,3 +41,2 @@ "main": "lib/index.js",

"autod": "^2.10.1",
"co": "^4.6.0",
"coffee": "^4.1.0",

@@ -51,7 +50,7 @@ "egg-bin": "^4.3.5",

"engines": {
"node": ">= 6.0.0"
"node": ">= 8.0.0"
},
"ci": {
"version": "6, 8"
"version": "8, 9"
}
}

@@ -52,2 +52,3 @@ # diskstore

});
yield diskStore.set('a/b/c', 'c');

@@ -54,0 +55,0 @@ let data = yield diskStore.get('a/b/c');

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