From 5f44a6cf1f16023a4c39872f2ccfc129c65ea812 Mon Sep 17 00:00:00 2001 From: James Hu <51237606+jameshu111@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:37:11 -0400 Subject: temp working version --- src/client/documents/Documents.ts | 3 +- src/client/views/nodes/ImageBox.tsx | 2 +- src/fields/URLField.ts | 2 +- src/server/ApiManagers/AzureManager.ts | 74 ++++++++++++++++++++++++++++++++++ src/server/DashUploadUtils.ts | 25 ++++++++---- 5 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 src/server/ApiManagers/AzureManager.ts (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index ffde9fe1b..ac6c48619 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -1739,7 +1739,8 @@ export namespace DocUtils { return; } const full = { ...options, _width: 400, title: name }; - const pathname = Utils.prepend(result.accessPaths.agnostic.client); + // const pathname = Utils.prepend(result.accessPaths.agnostic.client); + const pathname = result.accessPaths.azure.client; const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc); if (doc) { const proto = Doc.GetProto(doc); diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 9acbee1e7..de1365adc 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -295,7 +295,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent {}); @@ -323,12 +324,13 @@ export namespace DashUploadUtils { * 3) the size of the image, in bytes (4432130) * 4) the content type of the image, i.e. image/(jpeg | png | ...) */ - export const UploadImage = async (source: string, filename?: string, prefix: string = ''): Promise => { + export const UploadImage = async (source: string, filename?: string, originalFilename?: string, prefix: string = ''): Promise => { const metadata = await InspectImage(source); if (metadata instanceof Error) { return { name: metadata.name, message: metadata.message }; } - return UploadInspectedImage(metadata, filename || metadata.filename, prefix); + console.log(originalFilename); + return UploadInspectedImage(metadata, filename || metadata.filename, originalFilename, prefix); }; export async function buildFileDirectories() { @@ -478,17 +480,21 @@ export namespace DashUploadUtils { }; } - export const UploadInspectedImage = async (metadata: Upload.InspectionResults, filename?: string, prefix = '', cleanUp = true): Promise => { + export const UploadInspectedImage = async (metadata: Upload.InspectionResults, filename?: string, originalFilename?: string, prefix = '', cleanUp = true): Promise => { const { requestable, source, ...remaining } = metadata; const resolved = filename || `${prefix}upload_${Utils.GenerateGuid()}.${remaining.contentType.split('/')[1].toLowerCase()}`; const { images } = Directory; const information: Upload.ImageInformation = { accessPaths: { agnostic: getAccessPaths(images, resolved), + azure: { + client: `https://dashblobstore.blob.core.windows.net/dashmedia/${originalFilename}`, + server: `https://dashblobstore.blob.core.windows.net/dashmedia/${originalFilename}` + } }, ...metadata, }; - const writtenFiles = await outputResizedImages(() => request(requestable), resolved, pathToDirectory(Directory.images)); + const writtenFiles = await outputResizedImages(() => request(requestable), resolved, pathToDirectory(Directory.images), originalFilename, metadata.contentType); for (const suffix of Object.keys(writtenFiles)) { information.accessPaths[suffix] = getAccessPaths(images, writtenFiles[suffix]); } @@ -533,16 +539,21 @@ export namespace DashUploadUtils { force: true, }; - export async function outputResizedImages(streamProvider: () => Stream | Promise, outputFileName: string, outputDirectory: string) { + export async function outputResizedImages(streamProvider: () => Stream | Promise, outputFileName: string, outputDirectory: string, originalFilename?: string, contentType?: string) { + console.log("resized original filename: ", originalFilename); const writtenFiles: { [suffix: string]: string } = {}; for (const { resizer, suffix } of resizers(path.extname(outputFileName))) { const outputPath = path.resolve(outputDirectory, (writtenFiles[suffix] = InjectSize(outputFileName, suffix))); + console.log(`https://dashblobstore.blob.core.windows.net/dashmedia/${InjectSize(originalFilename!, suffix)}`); await new Promise(async (resolve, reject) => { const source = streamProvider(); let readStream: Stream = source instanceof Promise ? await source : source; if (resizer) { readStream = readStream.pipe(resizer.withMetadata()); } + if(originalFilename && contentType) { + AzureManager.UploadBlobStream(readStream as Readable, InjectSize(originalFilename, suffix), contentType); + } readStream.pipe(createWriteStream(outputPath)).on('close', resolve).on('error', reject); }); } -- cgit v1.2.3-70-g09d2 From abeda176df59157f3194dd86966725f6193997c6 Mon Sep 17 00:00:00 2001 From: James Hu <51237606+jameshu111@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:29:12 -0400 Subject: back to using original filename --- src/server/DashUploadUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index 53f2d6501..7abefed8a 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -488,8 +488,8 @@ export namespace DashUploadUtils { accessPaths: { agnostic: getAccessPaths(images, resolved), azure: { - client: `https://dashblobstore.blob.core.windows.net/dashmedia/${originalFilename}`, - server: `https://dashblobstore.blob.core.windows.net/dashmedia/${originalFilename}` + client: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}`, + server: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}` } }, ...metadata, @@ -545,6 +545,7 @@ export namespace DashUploadUtils { for (const { resizer, suffix } of resizers(path.extname(outputFileName))) { const outputPath = path.resolve(outputDirectory, (writtenFiles[suffix] = InjectSize(outputFileName, suffix))); console.log(`https://dashblobstore.blob.core.windows.net/dashmedia/${InjectSize(originalFilename!, suffix)}`); + console.log(`https://dashblobstore.blob.core.windows.net/dashmedia/${InjectSize(outputFileName, suffix)}`); await new Promise(async (resolve, reject) => { const source = streamProvider(); let readStream: Stream = source instanceof Promise ? await source : source; @@ -553,6 +554,7 @@ export namespace DashUploadUtils { } if(originalFilename && contentType) { AzureManager.UploadBlobStream(readStream as Readable, InjectSize(originalFilename, suffix), contentType); + AzureManager.UploadBlobStream(readStream as Readable, InjectSize(outputFileName, suffix), contentType); } readStream.pipe(createWriteStream(outputPath)).on('close', resolve).on('error', reject); }); -- cgit v1.2.3-70-g09d2 From 5a1c452941032c8a5c468e54674450f452d8bda9 Mon Sep 17 00:00:00 2001 From: James Hu <51237606+jameshu111@users.noreply.github.com> Date: Thu, 6 Jul 2023 11:22:44 -0400 Subject: flag with comments --- package.json | 2 +- src/client/documents/Documents.ts | 3 ++- src/server/DashUploadUtils.ts | 24 ++++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/package.json b/package.json index 3a3d17517..2b37d5171 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start-release": "cross-env RELEASE=true NODE_OPTIONS=--max_old_space_size=4096 ts-node-dev -- src/server/index.ts", "start": "cross-env NODE_OPTIONS=--max_old_space_size=4096 ts-node-dev --debug --transpile-only -- src/server/index.ts", "oldstart": "cross-env NODE_OPTIONS=--max_old_space_size=4096 ts-node-dev --debug -- src/server/index.ts", - "debug": "cross-env NODE_OPTIONS=--max_old_space_size=8192 ts-node-dev --transpile-only --inspect -- src/server/index.ts", + "debug": "cross-env USE_AZURE=true NODE_OPTIONS=--max_old_space_size=8192 ts-node-dev --transpile-only --inspect -- src/server/index.ts", "monitor": "cross-env MONITORED=true NODE_OPTIONS=--max_old_space_size=4096 ts-node src/server/index.ts", "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 webpack --env production", "test": "mocha -r ts-node/register test/**/*.ts", diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 93043e517..43c9d2e7a 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -1737,7 +1737,8 @@ export namespace DocUtils { } const full = { ...options, _width: 400, title: name }; // const pathname = Utils.prepend(result.accessPaths.agnostic.client); - const pathname = result.accessPaths.azure.client; + const pathname = result.accessPaths.agnostic.client; + // const pathname = result.accessPaths.azure.client; const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc); if (doc) { const proto = Doc.GetProto(doc); diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index 7abefed8a..74c4786b6 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -43,6 +43,10 @@ function isLocal() { return /Dash-Web[0-9]*[\\\/]src[\\\/]server[\\\/]public[\\\/](.*)/; } +function usingAzure(){ + return process.env.USE_AZURE === 'true'; +} + export namespace DashUploadUtils { export interface Size { width: number; @@ -183,6 +187,8 @@ export namespace DashUploadUtils { } export async function upload(file: File, overwriteGuid?: string): Promise { + const isAzureOn = usingAzure(); + console.log("Azure usage: ", isAzureOn); const { type, path, name } = file; const types = type?.split('/') ?? []; uploadProgress.set(overwriteGuid ?? name, 'uploading'); // If the client sent a guid it uses to track upload progress, use that guid. Otherwise, use the file's name. @@ -486,11 +492,15 @@ export namespace DashUploadUtils { const { images } = Directory; const information: Upload.ImageInformation = { accessPaths: { - agnostic: getAccessPaths(images, resolved), - azure: { + // agnostic: getAccessPaths(images, resolved), + // azure: { + // client: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}`, + // server: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}` + // } + agnostic: usingAzure() ? { client: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}`, server: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}` - } + } : getAccessPaths(images, resolved) }, ...metadata, }; @@ -540,7 +550,7 @@ export namespace DashUploadUtils { }; export async function outputResizedImages(streamProvider: () => Stream | Promise, outputFileName: string, outputDirectory: string, originalFilename?: string, contentType?: string) { - console.log("resized original filename: ", originalFilename); + const start = Date.now(); const writtenFiles: { [suffix: string]: string } = {}; for (const { resizer, suffix } of resizers(path.extname(outputFileName))) { const outputPath = path.resolve(outputDirectory, (writtenFiles[suffix] = InjectSize(outputFileName, suffix))); @@ -552,13 +562,15 @@ export namespace DashUploadUtils { if (resizer) { readStream = readStream.pipe(resizer.withMetadata()); } - if(originalFilename && contentType) { - AzureManager.UploadBlobStream(readStream as Readable, InjectSize(originalFilename, suffix), contentType); + if(contentType && usingAzure()) { + // AzureManager.UploadBlobStream(readStream as Readable, InjectSize(originalFilename, suffix), contentType); AzureManager.UploadBlobStream(readStream as Readable, InjectSize(outputFileName, suffix), contentType); } readStream.pipe(createWriteStream(outputPath)).on('close', resolve).on('error', reject); }); } + const end = Date.now(); + console.log(`Time taken: ${end - start}ms`); return writtenFiles; } -- cgit v1.2.3-70-g09d2 From 71a5c4a6ff126a256b4053d539b6099e5a429bbc Mon Sep 17 00:00:00 2001 From: James Hu <51237606+jameshu111@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:26:44 -0400 Subject: clean up --- src/server/ApiManagers/AzureManager.ts | 2 +- src/server/DashUploadUtils.ts | 72 ++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/server/ApiManagers/AzureManager.ts b/src/server/ApiManagers/AzureManager.ts index e105f5d80..7e319f123 100644 --- a/src/server/ApiManagers/AzureManager.ts +++ b/src/server/ApiManagers/AzureManager.ts @@ -3,7 +3,7 @@ import { ContainerClient, BlobServiceClient } from "@azure/storage-blob"; import * as fs from "fs"; import { Readable, Stream } from "stream"; // dotenv.config(); -const AZURE_STORAGE_CONNECTION_STRING = "DefaultEndpointsProtocol=https;AccountName=dashblobstore;AccountKey=3i+E5XkCz3TJ0m5QOatiEnbRACz9V1qCW72L6ldiYGH1tLdfJWa2eQoRfYmPA68lx1a6YAcfYJfWHadIxQvhGQ==;EndpointSuffix=core.windows.net"; +const AZURE_STORAGE_CONNECTION_STRING = process.env.AZURE_STORAGE_CONNECTION_STRING; export class AzureManager { private _containerClient: ContainerClient; diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index 74c4786b6..c33166d4a 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -18,6 +18,7 @@ import { AcceptableMedia, Upload } from './SharedMediaTypes'; import request = require('request-promise'); import formidable = require('formidable'); import { AzureManager } from './ApiManagers/AzureManager'; +import axios from 'axios'; const spawn = require('child_process').spawn; const { exec } = require('child_process'); const parse = require('pdf-parse'); @@ -66,6 +67,9 @@ export namespace DashUploadUtils { const size = 'content-length'; const type = 'content-type'; + const BLOBSTORE_URL = process.env.BLOBSTORE_URL; + const RESIZE_FUNCTION_URL = process.env.RESIZE_FUNCTION_URL; + const { imageFormats, videoFormats, applicationFormats, audioFormats } = AcceptableMedia; //TODO:glr export async function concatVideos(filePaths: string[]): Promise { @@ -336,7 +340,7 @@ export namespace DashUploadUtils { return { name: metadata.name, message: metadata.message }; } console.log(originalFilename); - return UploadInspectedImage(metadata, filename || metadata.filename, originalFilename, prefix); + return UploadInspectedImage(metadata, filename || metadata.filename, prefix); }; export async function buildFileDirectories() { @@ -486,25 +490,48 @@ export namespace DashUploadUtils { }; } - export const UploadInspectedImage = async (metadata: Upload.InspectionResults, filename?: string, originalFilename?: string, prefix = '', cleanUp = true): Promise => { + /** + * UploadInspectedImage() takes an image with its metadata. If Azure is being used, this method will call the Azure function + * to execute the resizing. If Azure is not used, the function will begin to resize the image. + * + * @param metadata metadata object from InspectImage() + * @param filename the name of the file + * @param prefix the prefix to use, which will be set to '' if none is provided. + * @param cleanUp a boolean indicating if the files should be deleted after upload. True by default. + * @returns the accessPaths for the resized files. + */ + export const UploadInspectedImage = async (metadata: Upload.InspectionResults, filename?: string, prefix = '', cleanUp = true): Promise => { const { requestable, source, ...remaining } = metadata; const resolved = filename || `${prefix}upload_${Utils.GenerateGuid()}.${remaining.contentType.split('/')[1].toLowerCase()}`; const { images } = Directory; const information: Upload.ImageInformation = { accessPaths: { - // agnostic: getAccessPaths(images, resolved), - // azure: { - // client: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}`, - // server: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}` - // } agnostic: usingAzure() ? { - client: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}`, - server: `https://dashblobstore.blob.core.windows.net/dashmedia/${filename}` + client: BLOBSTORE_URL + `/${filename}`, + server: BLOBSTORE_URL + `/${filename}` } : getAccessPaths(images, resolved) }, ...metadata, }; - const writtenFiles = await outputResizedImages(() => request(requestable), resolved, pathToDirectory(Directory.images), originalFilename, metadata.contentType); + let writtenFiles: { [suffix: string] : string}; + + if (usingAzure()) { + if (!RESIZE_FUNCTION_URL) { + throw new Error("Resize function URL not provided."); + } + + try { + const response = await axios.post(RESIZE_FUNCTION_URL, { + url: requestable + }); + writtenFiles = response.data.writtenFiles; + } catch (err) { + console.error(err); + writtenFiles = {}; + } + } else { + writtenFiles = await outputResizedImages(() => request(requestable), resolved, pathToDirectory(Directory.images)); + } for (const suffix of Object.keys(writtenFiles)) { information.accessPaths[suffix] = getAccessPaths(images, writtenFiles[suffix]); } @@ -549,31 +576,36 @@ export namespace DashUploadUtils { force: true, }; - export async function outputResizedImages(streamProvider: () => Stream | Promise, outputFileName: string, outputDirectory: string, originalFilename?: string, contentType?: string) { - const start = Date.now(); + /** + * outputResizedImages takes in a readable stream and resizes the images according to the sizes defined at the top of this file. + * + * The new images will be saved to the server with the corresponding prefixes. + * @param streamProvider a Stream of the image to process, taken from the /parsed_files location + * @param outputFileName the basename (No suffix) of the outputted file. + * @param outputDirectory the directory to output to, usually Directory.Images + * @returns a map with suffixes as keys and resized filenames as values. + */ + export async function outputResizedImages(streamProvider: () => Stream | Promise, outputFileName: string, outputDirectory: string) { const writtenFiles: { [suffix: string]: string } = {}; for (const { resizer, suffix } of resizers(path.extname(outputFileName))) { const outputPath = path.resolve(outputDirectory, (writtenFiles[suffix] = InjectSize(outputFileName, suffix))); - console.log(`https://dashblobstore.blob.core.windows.net/dashmedia/${InjectSize(originalFilename!, suffix)}`); - console.log(`https://dashblobstore.blob.core.windows.net/dashmedia/${InjectSize(outputFileName, suffix)}`); await new Promise(async (resolve, reject) => { const source = streamProvider(); let readStream: Stream = source instanceof Promise ? await source : source; if (resizer) { readStream = readStream.pipe(resizer.withMetadata()); } - if(contentType && usingAzure()) { - // AzureManager.UploadBlobStream(readStream as Readable, InjectSize(originalFilename, suffix), contentType); - AzureManager.UploadBlobStream(readStream as Readable, InjectSize(outputFileName, suffix), contentType); - } readStream.pipe(createWriteStream(outputPath)).on('close', resolve).on('error', reject); }); } - const end = Date.now(); - console.log(`Time taken: ${end - start}ms`); return writtenFiles; } + /** + * define the resizers to use + * @param ext the extension + * @returns an array of resizer functions from sharp + */ function resizers(ext: string): DashUploadUtils.ImageResizer[] { return [ { suffix: SizeSuffix.Original }, -- cgit v1.2.3-70-g09d2 From a5194a874236eafc42a61c96d5b22c8622170149 Mon Sep 17 00:00:00 2001 From: James Hu <51237606+jameshu111@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:32:43 -0400 Subject: clean up --- src/client/documents/Documents.ts | 2 -- src/server/ApiManagers/AzureManager.ts | 11 ++--------- src/server/DashUploadUtils.ts | 6 ++---- 3 files changed, 4 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 43c9d2e7a..2532ef226 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -1736,9 +1736,7 @@ export namespace DocUtils { return; } const full = { ...options, _width: 400, title: name }; - // const pathname = Utils.prepend(result.accessPaths.agnostic.client); const pathname = result.accessPaths.agnostic.client; - // const pathname = result.accessPaths.azure.client; const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc); if (doc) { const proto = Doc.GetProto(doc); diff --git a/src/server/ApiManagers/AzureManager.ts b/src/server/ApiManagers/AzureManager.ts index 7e319f123..12bb98ad0 100644 --- a/src/server/ApiManagers/AzureManager.ts +++ b/src/server/ApiManagers/AzureManager.ts @@ -1,8 +1,6 @@ import { ContainerClient, BlobServiceClient } from "@azure/storage-blob"; -// import * as dotenv from 'dotenv'; import * as fs from "fs"; import { Readable, Stream } from "stream"; -// dotenv.config(); const AZURE_STORAGE_CONNECTION_STRING = process.env.AZURE_STORAGE_CONNECTION_STRING; export class AzureManager { @@ -15,9 +13,8 @@ export class AzureManager { constructor() { if (!AZURE_STORAGE_CONNECTION_STRING) { - throw Error("Azure Storage Connection String Not Found"); + throw new Error("Azure Storage Connection String Not Found"); } - // this._blobServiceClient = BlobServiceClient.fromConnectionString(process.env.AZURE_STORAGE_CONNECTION_STRING); this._blobServiceClient = BlobServiceClient.fromConnectionString(AZURE_STORAGE_CONNECTION_STRING); this._containerClient = this.BlobServiceClient.getContainerClient(AzureManager.CONTAINER_NAME); } @@ -35,7 +32,6 @@ export class AzureManager { } public static UploadBlob(filename: string, filepath: string, filetype: string) { - console.log("Upload Blob File"); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); const blobOptions = { blobHTTPHeaders: { blobContentType: filetype }}; const stream = fs.createReadStream(filepath); @@ -43,20 +39,17 @@ export class AzureManager { } public static UploadBlobStream(stream: Readable, filename: string, filetype: string) { - console.log("Upload Blob Stream: %s, %s", filename, filetype); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); const blobOptions = { blobHTTPHeaders: { blobContentType: filetype }}; return blockBlobClient.uploadStream(stream, undefined, undefined, blobOptions); } public static DeleteBlob(filename: string) { - console.log("Delete Blob from filename"); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); return blockBlobClient.deleteIfExists(); } public static async GetBlobs() { - console.log("Get Blobs"); const foundBlobs = []; for await (const blob of this.Instance.ContainerClient.listBlobsFlat()) { console.log(`${blob.name}`); @@ -71,4 +64,4 @@ export class AzureManager { return foundBlobs; } -} \ No newline at end of file +} diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index c33166d4a..bff60568b 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -192,7 +192,6 @@ export namespace DashUploadUtils { export async function upload(file: File, overwriteGuid?: string): Promise { const isAzureOn = usingAzure(); - console.log("Azure usage: ", isAzureOn); const { type, path, name } = file; const types = type?.split('/') ?? []; uploadProgress.set(overwriteGuid ?? name, 'uploading'); // If the client sent a guid it uses to track upload progress, use that guid. Otherwise, use the file's name. @@ -204,7 +203,7 @@ export namespace DashUploadUtils { switch (category) { case 'image': if (imageFormats.includes(format)) { - const result = await UploadImage(path, basename(path), name); + const result = await UploadImage(path, basename(path)); return { source: file, result }; } fs.unlink(path, () => {}); @@ -334,12 +333,11 @@ export namespace DashUploadUtils { * 3) the size of the image, in bytes (4432130) * 4) the content type of the image, i.e. image/(jpeg | png | ...) */ - export const UploadImage = async (source: string, filename?: string, originalFilename?: string, prefix: string = ''): Promise => { + export const UploadImage = async (source: string, filename?: string, prefix: string = ''): Promise => { const metadata = await InspectImage(source); if (metadata instanceof Error) { return { name: metadata.name, message: metadata.message }; } - console.log(originalFilename); return UploadInspectedImage(metadata, filename || metadata.filename, prefix); }; -- cgit v1.2.3-70-g09d2