source: frontend/node_modules/workbox-build/src/lib/get-file-size.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 589 bytes
Line 
1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9import fse from 'fs-extra';
10
11import {errors} from './errors';
12
13export function getFileSize(file: string): number | null {
14 try {
15 const stat = fse.statSync(file);
16 if (!stat.isFile()) {
17 return null;
18 }
19 return stat.size;
20 } catch (err) {
21 throw new Error(
22 errors['unable-to-get-file-size'] +
23 ` '${err instanceof Error && err.message ? err.message : ''}'`,
24 );
25 }
26}
Note: See TracBrowser for help on using the repository browser.