metamuffin's personal website


About 1702120076831 milliseconds have passed since midnight of the january the first in 1970.
------------------------------------------------------



======================================
    Contents of "blog/helper.rs"
======================================
use anyhow::{anyhow, Context};
use futures::future::join_all;
use std::{
    path::{Path, PathBuf},
    process::Stdio,
};
use tokio::{
    fs::File,
    io::{AsyncBufReadExt, BufReader},
    process::Command,
};

pub struct ArticleMeta {
    pub title: String,
    pub canonical_name: String,
    pub date: iso8601::Date,
}

pub async fn article_metadata(path: PathBuf) -> anyhow::Result<ArticleMeta> {
    let f = File::open(&path).await.context("article not found")?;
    let mut f = BufReader::new(f);
    let mut buf = String::new();
    f.read_line(&mut buf).await.context("cant read the file")?; // assume the 1st line has the title
    Ok(ArticleMeta {