fixed exports

pull/62/head
tycrek 3 years ago
parent 2521ec6cf0
commit 759fcd1729
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -9,7 +9,7 @@ import { log } from './utils';
* @param {*} file The file to hash
* @returns The SHA1 hash
*/
module.exports = (file: FileData) =>
export default (file: FileData) =>
new Promise((resolve, reject) =>
toArray((fs.createReadStream(file.path)))
.then((parts: any[]) => Buffer.concat(parts.map((part: any) => (Buffer.isBuffer(part) ? part : Buffer.from(part)))))

@ -81,7 +81,7 @@ function getImageThumbnail(file: FileData) {
* @param {*} file The file to generate a thumbnail for
* @returns The thumbnail filename (NOT the path)
*/
module.exports = (file: FileData) =>
export default (file: FileData) =>
new Promise((resolve, reject) =>
(file.is.video ? getVideoThumbnail : file.is.image ? getImageThumbnail : () => Promise.resolve())(file)
.then(() => resolve((file.is.video || file.is.image) ? getNewName(file.randomId) : file.is.audio ? 'views/ass-audio-icon.png' : 'views/ass-file-icon.png'))

@ -18,7 +18,7 @@ function getVibrant(file: FileData, resolve: Function, reject: Function) {
.quality(QUALITY)
.getPalette()
.then((palettes) => resolve(palettes[Object.keys(palettes).sort((a, b) => palettes[b]!.population - palettes[a]!.population)[0]]!.hex))
.catch(() => reject);
.catch((err) => reject(err));
}
/**
@ -26,4 +26,4 @@ function getVibrant(file: FileData, resolve: Function, reject: Function) {
* @param {*} file The file to get a colour from
* @returns The Vibrant colour as a Hex value (or random Hex value for videos)
*/
module.exports = (file: FileData) => new Promise((resolve, reject) => !file.is.image ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229
export default (file: FileData) => new Promise((resolve, reject) => !file.is.image ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229

Loading…
Cancel
Save