mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
28 lines
634 B
TypeScript
28 lines
634 B
TypeScript
import { ExecOptions } from 'node:child_process'
|
|
import path from 'path'
|
|
|
|
export function getDirPath(id: string) {
|
|
return `/tmp/pdfer-${id}`
|
|
}
|
|
|
|
export function getDocPath(id: string) {
|
|
return path.join(getDirPath(id), 'doc.tex')
|
|
}
|
|
|
|
export function getPdfPath(id: string) {
|
|
return path.join(getDirPath(id), 'doc.pdf')
|
|
}
|
|
|
|
export function getTexCmd(id: string): { cmd: string; options: ExecOptions } {
|
|
return {
|
|
cmd: `pdflatex -interaction nonstopmode ${getDocPath(id)}`,
|
|
options: {
|
|
cwd: getDirPath(id),
|
|
env: {
|
|
...process.env,
|
|
TEXMFHOME: path.join(process.cwd(), 'texmf'),
|
|
}
|
|
},
|
|
}
|
|
}
|