refactor(media): share outbound attachment resolver

This commit is contained in:
Peter Steinberger
2026-02-15 13:53:22 +00:00
parent abb4b7c91c
commit 7d0c0bfc7c
3 changed files with 20 additions and 34 deletions

View File

@@ -0,0 +1,16 @@
import { loadWebMedia } from "../web/media.js";
import { saveMediaBuffer } from "./store.js";
export async function resolveOutboundAttachmentFromUrl(
mediaUrl: string,
maxBytes: number,
): Promise<{ path: string; contentType?: string }> {
const media = await loadWebMedia(mediaUrl, maxBytes);
const saved = await saveMediaBuffer(
media.buffer,
media.contentType ?? undefined,
"outbound",
maxBytes,
);
return { path: saved.path, contentType: saved.contentType };
}