1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var pathModule = require('path');
|
9 |
|
10 | var fs = require('fs');
|
11 |
|
12 |
|
13 | var klawSync = require('klaw-sync');
|
14 |
|
15 |
|
16 | var md5 = require('md5');
|
17 |
|
18 | var dirChecksum = function dirChecksum(dirPath) {
|
19 | var extraPaths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
20 | var files = klawSync(pathModule.resolve(dirPath), {
|
21 | nodir: true
|
22 | }).map(function (f) {
|
23 | return f.path;
|
24 | });
|
25 | var extraFiles = extraPaths.map(function (p) {
|
26 | return pathModule.resolve(p);
|
27 | });
|
28 | files = files.concat(extraFiles);
|
29 | var md5s = files.map(function (f) {
|
30 | return fs.readFileSync(f);
|
31 | });
|
32 | var concatenatedMd5s = md5s.join();
|
33 | var finalMd5 = md5(concatenatedMd5s);
|
34 | return finalMd5;
|
35 | };
|
36 |
|
37 | var _default = dirChecksum;
|
38 | exports.default = _default; |
\ | No newline at end of file |