aboutsummaryrefslogtreecommitdiff
path: root/src/server/ApiManagers/PDFManager.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-12-03 01:46:36 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-12-03 01:46:36 -0500
commitef94ad7df2a087141ddb8d347d3e3c484ff7609b (patch)
treea7c16be04ff4050da1ff03e02f59df6da4f5f7e2 /src/server/ApiManagers/PDFManager.ts
parent62c888ad25c5580441eaf947a1a0f1638939b868 (diff)
const linter rule and restored google docs push, fixed routing
Diffstat (limited to 'src/server/ApiManagers/PDFManager.ts')
-rw-r--r--src/server/ApiManagers/PDFManager.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/ApiManagers/PDFManager.ts b/src/server/ApiManagers/PDFManager.ts
index 151b48dd9..a190ab0cb 100644
--- a/src/server/ApiManagers/PDFManager.ts
+++ b/src/server/ApiManagers/PDFManager.ts
@@ -8,7 +8,7 @@ const imageSize = require("probe-image-size");
import * as express from "express";
import * as path from "path";
import { Directory, serverPathToFile, clientPathToFile } from "./UploadManager";
-import { ConsoleColors } from "../ActionUtilities";
+import { red } from "colors";
export default class PDFManager extends ApiManager {
@@ -32,10 +32,10 @@ function getOrCreateThumbnail(thumbnailName: string, res: express.Response) {
const path = serverPathToFile(Directory.pdf_thumbnails, thumbnailName);
exists(path, (exists: boolean) => {
if (exists) {
- let existingThumbnail = createReadStream(path);
+ const existingThumbnail = createReadStream(path);
imageSize(existingThumbnail, (err: any, { width, height }: any) => {
if (err) {
- console.log(ConsoleColors.Red, `In PDF thumbnail response, unable to determine dimensions of ${thumbnailName}:`);
+ console.log(red(`In PDF thumbnail response, unable to determine dimensions of ${thumbnailName}:`));
console.log(err);
return;
}
@@ -81,7 +81,7 @@ async function CreateThumbnail(file: string, pageNumber: number, res: express.Re
});
});
out.on("error", error => {
- console.log(ConsoleColors.Red, `In PDF thumbnail creation, encountered the following error when piping ${pngFile}:`);
+ console.log(red(`In PDF thumbnail creation, encountered the following error when piping ${pngFile}:`));
console.log(error);
});
}
@@ -89,8 +89,8 @@ async function CreateThumbnail(file: string, pageNumber: number, res: express.Re
class NodeCanvasFactory {
create = (width: number, height: number) => {
- var canvas = createCanvas(width, height);
- var context = canvas.getContext('2d');
+ const canvas = createCanvas(width, height);
+ const context = canvas.getContext('2d');
return {
canvas,
context