|
|
@ -12,5 +12,5 @@ export default (file: FileData): Promise<string> =>
|
|
|
|
toArray((fs.createReadStream(file.path)))
|
|
|
|
toArray((fs.createReadStream(file.path)))
|
|
|
|
.then((parts: any[]) => Buffer.concat(parts.map((part: any) => (Buffer.isBuffer(part) ? part : Buffer.from(part)))))
|
|
|
|
.then((parts: any[]) => Buffer.concat(parts.map((part: any) => (Buffer.isBuffer(part) ? part : Buffer.from(part)))))
|
|
|
|
.then((buf: Buffer) => crypto.createHash('sha1').update(buf).digest('hex')) // skipcq: JS-D003
|
|
|
|
.then((buf: Buffer) => crypto.createHash('sha1').update(buf).digest('hex')) // skipcq: JS-D003
|
|
|
|
.then((hash: String) => log.debug(`Hash for ${file.originalname}`, hash, 'SHA1, hex').callback(resolve, hash))
|
|
|
|
.then((hash: string) => log.debug(`Hash for ${file.originalname}`, hash, 'SHA1, hex').callback(resolve, hash))
|
|
|
|
.catch(reject));
|
|
|
|
.catch(reject));
|
|
|
|