serverless/lib/utils/getCacheFile.js
2017-06-07 18:40:05 -07:00

19 lines
454 B
JavaScript

'use strict';
const fileExists = require('./fs/fileExists');
const readFile = require('./fs/readFile');
const getCacheFilePath = require('./getCacheFilePath');
const getCacheFile = function (servicePath) {
const cacheFilePath = getCacheFilePath(servicePath);
return fileExists(cacheFilePath)
.then((exists) => {
if (!exists) {
return false;
}
return readFile(cacheFilePath);
});
};
module.exports = getCacheFile;