Version: 0.0.10.0.20.0.31.0.01.0.11.1.01.2.01.3.02.0.02.0.12.0.2-2.0.2-rc1.02.0.2-rc12.0.22.0.32.1.02.1.12.1.22.1.33.0.0-alpha.13.0.0-alpha.23.0.0-alpha.33.0.0-alpha.43.0.0-alpha.53.0.0-alpha.63.0.0-beta.03.0.0-beta.13.0.0-beta.23.0.03.0.13.1.03.2.03.3.03.3.13.4.13.5.03.6.13.6.23.6.34.0.0-alpha.04.0.0-beta.04.0.0-beta.14.0.0-beta.24.0.0-rc.04.0.0-rc.14.0.0-rc.24.0.0-rc.34.0.0-rc.44.0.04.1.04.1.14.2.04.3.04.3.15.0.0-alpha.05.0.0-alpha.15.0.0-alpha.25.0.0-beta.05.0.0-beta.15.0.0-rc.05.0.0-rc.15.0.0-rc.25.0.05.1.05.1.15.1.25.1.35.1.46.0.0-alpha.06.0.0-alpha.16.0.0-alpha.26.0.0-alpha.36.0.0-rc.06.0.06.0.26.1.06.1.16.1.26.1.56.2.0-alpha.06.2.0-alpha.16.2.0-alpha.26.2.06.2.16.2.26.2.36.2.46.3.06.4.06.4.16.4.26.5.06.5.16.5.26.5.36.5.46.6.06.6.17.0.07.1.07.1.1
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const fs = require('fs');
const errors = require('./errors');
module.exports = (file) => {
try {
const stat = fs.statSync(file);
if (!stat.isFile()) {
return null;
}
return stat.size;
} catch (err) {
throw new Error(errors['unable-to-get-file-size'] + ` '${err.message}'`);
};