UNPKG

serverless

Version:

Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more

17 lines (13 loc) 372 B
'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;