INNER CODE UNIT · JavaScript

getMimeType

ruwiss/ai-auto-free · ai-auto-free/backend/index.js:60

function getMimeType(filename) {
  const ext = path.extname(filename).toLowerCase();
  const mimeTypes = {
    ".py": "text/x-python",
  };
  return mimeTypes[ext] || "application/octet-stream";
}

// Dosya hash'ini hesaplayan yardımcı fonksiyon
async function calculateFileHash(filePath) {
  try {
    const fileContent = await fsPromises.readFile(filePath);
    return crypto.createHash("sha256").update(fileContent).digest("hex");
  } catch (error) {
    throw new Error("Error calculating file hash");
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…