From d0646ac7c469f4c85dec7fe3c67e474b679c39b3 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 17 Apr 2023 02:39:48 -0400 Subject: [PATCH] *refactor continued --- src/contentProviders/ipfsProvider.ts | 34 ---------------------------- 1 file changed, 34 deletions(-) diff --git a/src/contentProviders/ipfsProvider.ts b/src/contentProviders/ipfsProvider.ts index 6504f96..c257d85 100644 --- a/src/contentProviders/ipfsProvider.ts +++ b/src/contentProviders/ipfsProvider.ts @@ -179,21 +179,6 @@ export default class IpfsProvider extends BaseProvider { // @ts-ignore for await (const chunk of reader.iterable()) { streamWriter.write(chunk); - if (bufferRead < fileTypeBufferLength) { - if (chunk.length >= fileTypeBufferLength) { - mimeBuffer.push(chunk.slice(0, fileTypeBufferLength)); - bufferRead += fileTypeBufferLength; - } else { - mimeBuffer.push(chunk); - bufferRead += chunk.length; - } - - if (bufferRead >= fileTypeBufferLength) { - checkMime = true; - } - } else { - checkMime = true; - } } } catch (e) { streamWriter.releaseLock(); @@ -201,25 +186,6 @@ export default class IpfsProvider extends BaseProvider { return; } - if (checkMime) { - const mime = await fileTypeFromBuffer( - mimeBuffer.reduce((acc, val) => { - return new Uint8Array([...acc, ...val]); - }, new Uint8Array()) - ); - - if (mime) { - provider.setData(details, "contentType", mime.mime); - } - - if (!mime) { - const ext = path.parse(urlPath).ext.replace(".", ""); - if (extToMimes.has(ext)) { - provider.setData(details, "contentType", extToMimes.get(ext)); - } - } - } - streamWriter.releaseLock(); reqStream.close(); })();