mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-09-24 15:00:31 +08:00
* chore: add open graph images * fix: open graph function * fix: open graph query params * fix: remove guide id * fix: generate images on build time * fix: external author image * fix: special character issue --------- Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
13 lines
327 B
TypeScript
13 lines
327 B
TypeScript
import imageSize from 'image-size';
|
|
import { readFile } from 'node:fs/promises';
|
|
|
|
export async function getLocalImageDimensions(path: string) {
|
|
try {
|
|
const imageBuffer = await readFile(path);
|
|
return imageSize(imageBuffer);
|
|
} catch (error) {
|
|
console.error(error, (error as Error)?.stack);
|
|
return null;
|
|
}
|
|
}
|