fix lint
This commit is contained in:
@ -66,7 +66,7 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
||||
//#region Uploads
|
||||
logger.info(`uploading original: ${key}`);
|
||||
const uploads = [
|
||||
upload(key, fs.createReadStream(path), type, name)
|
||||
upload(key, fs.createReadStream(path), type, name),
|
||||
];
|
||||
|
||||
if (alts.webpublic) {
|
||||
@ -149,13 +149,13 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
const thumbnail = await GenerateVideoThumbnail(path);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail
|
||||
thumbnail,
|
||||
};
|
||||
} catch (e) {
|
||||
logger.warn(`GenerateVideoThumbnail failed: ${e}`);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
thumbnail: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
logger.debug(`web image and thumbnail not created (not an required file)`);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
thumbnail: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -179,14 +179,14 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
if (isAnimated) {
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
thumbnail: null,
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn(`sharp failed: ${e}`);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
thumbnail: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ async function upload(key: string, stream: fs.ReadStream | Buffer, type: string,
|
||||
const s3 = getS3(meta);
|
||||
|
||||
const upload = s3.upload(params, {
|
||||
partSize: s3.endpoint?.hostname === 'storage.googleapis.com' ? 500 * 1024 * 1024 : 8 * 1024 * 1024
|
||||
partSize: s3.endpoint?.hostname === 'storage.googleapis.com' ? 500 * 1024 * 1024 : 8 * 1024 * 1024,
|
||||
});
|
||||
|
||||
const result = await upload.promise();
|
||||
@ -361,7 +361,7 @@ export default async function(
|
||||
|
||||
const driveFolder = await DriveFolders.findOne({
|
||||
id: folderId,
|
||||
userId: user ? user.id : null
|
||||
userId: user ? user.id : null,
|
||||
});
|
||||
|
||||
if (driveFolder == null) throw new Error('folder-not-found');
|
||||
@ -436,7 +436,7 @@ export default async function(
|
||||
|
||||
file = await DriveFiles.findOne({
|
||||
uri: file.uri,
|
||||
userId: user ? user.id : null
|
||||
userId: user ? user.id : null,
|
||||
}) as DriveFile;
|
||||
} else {
|
||||
logger.error(e);
|
||||
|
@ -98,6 +98,6 @@ export async function deleteObjectStorageFile(key: string) {
|
||||
|
||||
await s3.deleteObject({
|
||||
Bucket: meta.objectStorageBucket!,
|
||||
Key: key
|
||||
Key: key,
|
||||
}).promise();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ export async function GenerateVideoThumbnail(path: string): Promise<IImage> {
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
FFmpeg({
|
||||
source: path
|
||||
source: path,
|
||||
})
|
||||
.on('end', res)
|
||||
.on('error', rej)
|
||||
@ -21,7 +21,7 @@ export async function GenerateVideoThumbnail(path: string): Promise<IImage> {
|
||||
folder: outDir,
|
||||
filename: 'output.png',
|
||||
count: 1,
|
||||
timestamps: ['5%']
|
||||
timestamps: ['5%'],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -18,19 +18,19 @@ export async function convertSharpToJpeg(sharp: sharp.Sharp, width: number, heig
|
||||
const data = await sharp
|
||||
.resize(width, height, {
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true
|
||||
withoutEnlargement: true,
|
||||
})
|
||||
.rotate()
|
||||
.jpeg({
|
||||
quality: 85,
|
||||
progressive: true
|
||||
progressive: true,
|
||||
})
|
||||
.toBuffer();
|
||||
|
||||
return {
|
||||
data,
|
||||
ext: 'jpg',
|
||||
type: 'image/jpeg'
|
||||
type: 'image/jpeg',
|
||||
};
|
||||
}
|
||||
|
||||
@ -46,18 +46,18 @@ export async function convertSharpToWebp(sharp: sharp.Sharp, width: number, heig
|
||||
const data = await sharp
|
||||
.resize(width, height, {
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true
|
||||
withoutEnlargement: true,
|
||||
})
|
||||
.rotate()
|
||||
.webp({
|
||||
quality: 85
|
||||
quality: 85,
|
||||
})
|
||||
.toBuffer();
|
||||
|
||||
return {
|
||||
data,
|
||||
ext: 'webp',
|
||||
type: 'image/webp'
|
||||
type: 'image/webp',
|
||||
};
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ export async function convertSharpToPng(sharp: sharp.Sharp, width: number, heigh
|
||||
const data = await sharp
|
||||
.resize(width, height, {
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true
|
||||
withoutEnlargement: true,
|
||||
})
|
||||
.rotate()
|
||||
.png()
|
||||
@ -82,7 +82,7 @@ export async function convertSharpToPng(sharp: sharp.Sharp, width: number, heigh
|
||||
return {
|
||||
data,
|
||||
ext: 'png',
|
||||
type: 'image/png'
|
||||
type: 'image/png',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ export function getS3(meta: Meta) {
|
||||
? false
|
||||
: meta.objectStorageS3ForcePathStyle,
|
||||
httpOptions: {
|
||||
agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy)
|
||||
}
|
||||
agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export default async (
|
||||
error = e;
|
||||
logger.error(`Failed to create drive file: ${e}`, {
|
||||
url: url,
|
||||
e: e
|
||||
e: e,
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user