From a458e26fcaf07989ce2f46039e70dd2a92604ed1 Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Mon, 27 Jun 2022 15:39:05 -0500 Subject: [PATCH] Add extension helper property to input.file result --- src/components/upload.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/upload.ts b/src/components/upload.ts index 8f84e1a..f182740 100644 --- a/src/components/upload.ts +++ b/src/components/upload.ts @@ -1,3 +1,4 @@ +import path from 'path' import fetch, { Response } from 'node-fetch' import { IntervalError } from '..' import { T_IO_PROPS, T_IO_RETURNS } from '../ioSchema' @@ -8,6 +9,9 @@ export function file(_: T_IO_PROPS<'UPLOAD_FILE'>) { return { ...response, lastModified: new Date(response.lastModified), + get extension(): string { + return path.extname(response.name) + }, async url(): Promise { return url },