79253404

Date: 2024-12-05 04:32:04
Score: 1
Natty:
Report link

Wait I found it, it seems so obvious now, just use readFileSync from fs.

import { readFileSync } from "node:fs"

export async function load({ }) {
    let latestVid

    try {
        latestVid = JSON.parse(readFileSync('/srv/site-scraper/latest-posts/latest-vid.json'))
    } catch (e) {
        return { "error" : e.default }
    }

    return {
        "latestVid" : latestVid
    }
  }

I just wasn't asking the right questions to find the right answers on Google to begin with.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Arden