Comparing version 0.2.0 to 0.3.0
@@ -5,7 +5,4 @@ 'use strict'; | ||
const toAbsolute = require('path').resolve; | ||
const cache = new Map(); | ||
const symbol = Symbol.for('fcache'); | ||
const cache = global[symbol] || new Map(); | ||
global[symbol] = cache; | ||
exports.readFile = path => new Promise((resolve, reject) => { | ||
@@ -17,3 +14,3 @@ const absPath = toAbsolute(path); | ||
} | ||
fs.readFile(absPath, 'utf-8', (error, data) => { | ||
fs.readFile(absPath, (error, data) => { | ||
if (error) reject(error); | ||
@@ -26,3 +23,3 @@ else resolve(data); | ||
const absPath = toAbsolute(path); | ||
fs.readFile(absPath, 'utf-8', (error, data) => { | ||
fs.readFile(absPath, (error, data) => { | ||
if (error) { | ||
@@ -29,0 +26,0 @@ reject(error); |
{ | ||
"name": "fcache", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Standartized fs.readFile caching mechanism for incremental build systems.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -29,1 +29,5 @@ # fcache | ||
~0.2 | > 4.0 | ||
## License | ||
[The MIT License](https://github.com/paulmillr/mit) (c) 2016 Paul Miller (http://paulmillr.com) |
1593
33
26