From f03435c17654dfee015eba0f05a2d2220344b2b9 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Mon, 5 Sep 2022 04:54:03 +0200 Subject: [PATCH] don't use url_parse module the URL constructor provides all your needs already, and the url_parse module is just an unecessary module --- src/image.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/image.ts b/src/image.ts index 10f550e..06959fd 100644 --- a/src/image.ts +++ b/src/image.ts @@ -1,5 +1,4 @@ import { mime } from "https://cdn.deno.land/mimetypes/versions/v1.0.0/raw/mod.ts" -import { urlParse } from 'https://cdn.deno.land/url_parse/versions/1.0.0/raw/mod.ts'; import { basename } from "https://deno.land/std@0.92.0/path/mod.ts"; export async function readImageFromURL(url: string): Promise<{ bytes: Uint8Array; name: string; }> { @@ -8,7 +7,7 @@ export async function readImageFromURL(url: string): Promise<{ bytes: Uint8Array const imageBytes = new Uint8Array(await response.arrayBuffer()); const extension = mime.getExtension(mimeType as string); - const defaultName = basename(urlParse(url).pathname) + const defaultName = basename(new URL(url).pathname) let defaultImageName = defaultName // if image name does NOT include an extension