@mux/blurup
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { imageDimensionsFromStream } from 'image-dimensions'; | ||
import { imageDimensionsFromData } from 'image-dimensions'; | ||
@@ -87,2 +87,15 @@ const defaultOptions = { | ||
async function imageDimensionsFromStream(stream) { | ||
let chunks = []; | ||
for await (const chunk of stream) { | ||
chunks = [...chunks, ...chunk]; | ||
const dimensions = imageDimensionsFromData(new Uint8Array(chunks)); | ||
if (dimensions) { | ||
return dimensions; | ||
} | ||
} | ||
} | ||
async function getTinyImageDataURL(imageURL, fetchOptions) { | ||
@@ -89,0 +102,0 @@ const response = await fetch(imageURL, fetchOptions); |
{ | ||
"name": "@mux/blurup", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Generate a blurry image placeholder for a Mux video.", |
10316
2.75%129
8.4%