2021-03-14 02:42:46 -05:00
|
|
|
import crypto from 'crypto';
|
2017-12-02 03:52:40 -05:00
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
2017-07-24 16:09:28 -05:00
|
|
|
|
2017-12-02 03:52:40 -05:00
|
|
|
function generateSha(key) {
|
2019-07-16 01:40:01 -05:00
|
|
|
// @ts-ignore
|
2021-03-14 02:42:46 -05:00
|
|
|
return (
|
|
|
|
crypto
|
|
|
|
// @ts-ignore
|
|
|
|
.createHash('sha1', 'binary')
|
|
|
|
.update(key)
|
|
|
|
.digest('hex')
|
|
|
|
);
|
2017-12-02 03:52:40 -05:00
|
|
|
}
|
2017-07-24 16:09:28 -05:00
|
|
|
|
2017-12-02 03:52:40 -05:00
|
|
|
function readFile(filePath) {
|
2017-07-24 16:09:28 -05:00
|
|
|
return fs.readFileSync(path.join(__dirname, `/${filePath}`));
|
|
|
|
}
|
2017-12-02 03:52:40 -05:00
|
|
|
|
2021-03-14 02:42:46 -05:00
|
|
|
export { generateSha, readFile };
|