mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
17 lines
372 B
JavaScript
17 lines
372 B
JavaScript
'use strict';
|
|
|
|
const fileExists = require('./fileExists');
|
|
const readFile = require('./readFile');
|
|
const BbPromise = require('bluebird');
|
|
|
|
const readFileIfExists = function(filePath) {
|
|
return fileExists(filePath).then(exists => {
|
|
if (!exists) {
|
|
return BbPromise.resolve(false);
|
|
}
|
|
return readFile(filePath);
|
|
});
|
|
};
|
|
|
|
module.exports = readFileIfExists;
|