Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

542 B
Raw Blame
import { ArchivedFormat } from "@linkwarden/types/global";

const getLinkTypeFromFormat = (
  format: ArchivedFormat
): "image" | "pdf" | "readable" | "monolith" => {
  switch (format) {
    case ArchivedFormat.readability:
      return "readable";
    case ArchivedFormat.monolith:
      return "monolith";
    case ArchivedFormat.jpeg:
    case ArchivedFormat.png:
      return "image";
    case ArchivedFormat.pdf:
      return "pdf";
    default:
      throw new Error("Invalid file type.");
  }
};

export default getLinkTypeFromFormat;