From b1a3c225b249a4b7d3a4061bc2af285467fca4f8 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 18 Mar 2024 10:24:22 -0400 Subject: [PATCH] Remove usage of url module --- src/io/index.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/io/index.ts b/src/io/index.ts index a0852b2c..b60ec916 100644 --- a/src/io/index.ts +++ b/src/io/index.ts @@ -1,15 +1,7 @@ -import url from 'url' import { ensureNotNullish } from '../typescript' import { Filehandle } from '../cramFile/filehandle' import { LocalFile, RemoteFile } from 'generic-filehandle' -function fromUrl(source: string) { - const { protocol, pathname } = url.parse(source) - if (protocol === 'file:') { - return new LocalFile(unescape(ensureNotNullish(pathname))) - } - return new RemoteFile(source) -} function open( maybeUrl?: string, @@ -20,7 +12,7 @@ function open( return maybeFilehandle } if (maybeUrl) { - return fromUrl(maybeUrl) + return new RemoteFile(maybeUrl) } if (maybePath) { return new LocalFile(maybePath) @@ -28,6 +20,6 @@ function open( throw new Error('no url, path, or filehandle provided, cannot open') } -export { fromUrl, open } +export { open } export { LocalFile, RemoteFile } from 'generic-filehandle'