Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var expires = (typeof sess.cookie.expires === 'string')
? new Date(sess.cookie.expires)
: sess.cookie.expires;
if (!expires || new Date < expires) {
// session ok
} else {
self.destroy(file);
}
});
});
});
}, self.reapInterval);
}
};
FileStore.prototype.__proto__ = Store.prototype;
FileStore.prototype.get = function(sid, fn){
var self = this;
var exists = fs.exists || path.exists;
exists(self.basePath + "/" + sid, function(exists) {
if (exists) {
fs.readFile(self.basePath + "/" + sid, function(err, data) {
if (err) {
fn && fn(err);
}
else {
var sess;
try {
sess = JSON.parse(data);
} catch(e) {
console.warn("Error '" + e + "' reading session: " + sid, data);