* oom(01): A1-shared-readers — reintroduce #10179 subset Files: 18 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(02): A2-shared-image-media — reintroduce #10179 subset Files: 7 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
14 lines
471 B
TypeScript
14 lines
471 B
TypeScript
import { measureUtf8ByteLength } from './utf8-byte-limits'
|
|
|
|
export const HTML_TO_PDF_MAX_INPUT_BYTES = 32 * 1024 * 1024
|
|
export const HTML_TO_PDF_MEMORY_LIMIT_ERROR = 'HTML export exceeds the PDF memory limit'
|
|
|
|
export function assertHtmlToPdfInputWithinMemoryLimit(
|
|
html: string,
|
|
maxBytes = HTML_TO_PDF_MAX_INPUT_BYTES
|
|
): void {
|
|
if (measureUtf8ByteLength(html, { stopAfterBytes: maxBytes }).exceededLimit) {
|
|
throw new Error(HTML_TO_PDF_MEMORY_LIMIT_ERROR)
|
|
}
|
|
}
|