import { join } from "node:path";

export function casPathFor(hash: string) {
    const a = hash.slice(0, 2), b = hash.slice(2, 4);
    return `sha256/${a}/${b}/${hash}`;
}

//chemin absolue du storage
export function getAbsolutePath(storagePathRel: string) {
    return join(this.root, storagePathRel);
}


export function startOfYear(): Date {
    const now = new Date();
    return new Date(Date.UTC(now.getUTCFullYear(), 0, 1, 0, 0, 0, 0));
}