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