source: frontend/node_modules/workbox-build/src/lib/get-composite-details.ts

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

Fix frontend appearance

  • Property mode set to 100644
File size: 746 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 crypto from 'crypto';
10
11import {FileDetails} from '../types';
12
13export function getCompositeDetails(
14 compositeURL: string,
15 dependencyDetails: Array<FileDetails>,
16): FileDetails {
17 let totalSize = 0;
18 let compositeHash = '';
19
20 for (const fileDetails of dependencyDetails) {
21 totalSize += fileDetails.size;
22 compositeHash += fileDetails.hash;
23 }
24
25 const md5 = crypto.createHash('md5');
26 md5.update(compositeHash);
27 const hashOfHashes = md5.digest('hex');
28
29 return {
30 file: compositeURL,
31 hash: hashOfHashes,
32 size: totalSize,
33 };
34}
Note: See TracBrowser for help on using the repository browser.