Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "castor", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "An ES7 [CAS designed](https://en.wikipedia.org/wiki/Content-addressable_storage) file storage for nodejs with a simple API and robust implementation.", | ||
@@ -5,0 +5,0 @@ "main": "store.js", |
12
store.js
@@ -33,4 +33,4 @@ 'use strict'; | ||
const MD5_EMPTY_FILE = 'd41d8cd98f00b204e9800998ecf8427e'; | ||
class Store { | ||
@@ -128,5 +128,11 @@ | ||
var file_path = this.getFilePathFromMd5(file_md5); | ||
if(fs.existsSync(file_path)) | ||
return false; | ||
try { | ||
const {size} = fs.statSync(file_path); | ||
if(size == 0 && file_md5 != MD5_EMPTY_FILE) | ||
fs.unlinkSync(file_path); | ||
else | ||
return false; | ||
} catch(err) {} | ||
mkdirpSync(path.dirname(file_path)); | ||
@@ -133,0 +139,0 @@ var tmp_path = `${file_path}.tmp.${guid()}`; |
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
12503
211