diff --git a/lib/packageModules.js b/lib/packageModules.js index 650a3cf24..7fffcdf97 100644 --- a/lib/packageModules.js +++ b/lib/packageModules.js @@ -9,6 +9,9 @@ const semver = require('semver'); const fs = require('fs'); const { getAllNodeFunctions, isProviderGoogle } = require('./utils'); +const readFileAsync = BbPromise.promisify(fs.readFile); +const statAsync = BbPromise.promisify(fs.stat); + function setArtifactPath(funcName, func, artifactPath) { const version = this.serverless.getVersion(); @@ -90,8 +93,8 @@ function getFileContentAndStat(directory, filePath) { return BbPromise.all([ // Get file contents and stat in parallel - fs.readFileAsync(fullPath), - fs.statAsync(fullPath) + readFileAsync(fullPath), + statAsync(fullPath) ]).then( result => ({ data: result[0],