Use SHA256 for cache filenames, camelCase function

This commit is contained in:
Nadav Ivgi 2017-12-22 03:46:46 +02:00
parent 2ac18b6ce4
commit 668659b233
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import fs from 'fs-extra'
const engines = [ require('./preview/image'), require('./preview/ffmpeg'), require('./preview/unoconv') ]
const cache_name = file => crypto.createHash('sha1').update(file.fullpath).digest('hex')
const cacheName = file => crypto.createHash('sha256').update(file.fullpath).digest('hex')
module.exports = (files, cache_path) => {
@ -15,7 +15,7 @@ module.exports = (files, cache_path) => {
const preview = async file => {
const p = engines.find(p => p.preview && p.detect(file))
if (p) {
const dest = path.join(cache_path, cache_name(file)) + '.' + p.ext(file)
const dest = path.join(cache_path, cacheName(file)) + '.' + p.ext(file)
if (!await fs.pathExists(dest)) await p.preview(file.fullpath, dest)
return dest
}