Files
klz-cables.com/.pnpm-store/v10/files/bb/f9aeae5721c0092c1505bab9fbbd6ab656b96e4172be1f884d3d400c2e1a99efa75885e02c48c855954aa0a194110cd4ddaf67595ad6134d796da4d1fef1a4
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

26 lines
692 B
Plaintext

import { fileTypeFromFile } from 'file-type';
import fs from 'fs/promises';
import path from 'path';
const mimeTypeEstimate = {
svg: 'image/svg+xml'
};
export const getFileByPath = async (filePath)=>{
if (typeof filePath !== 'string') {
return undefined;
}
const name = path.basename(filePath);
const ext = path.extname(filePath).slice(1);
const [data, stat, type] = await Promise.all([
fs.readFile(filePath),
fs.stat(filePath),
fileTypeFromFile(filePath)
]);
return {
name,
data,
mimetype: type?.mime || mimeTypeEstimate[ext],
size: stat.size
};
};
//# sourceMappingURL=getFileByPath.js.map