Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust storage of resumes #45

Open
Struck713 opened this issue Mar 7, 2024 · 1 comment
Open

More robust storage of resumes #45

Struck713 opened this issue Mar 7, 2024 · 1 comment
Assignees

Comments

@Struck713
Copy link
Contributor

Struck713 commented Mar 7, 2024

Instead of passing a Base64 string around, create an Express route where we can upload (and later request for viewing) resumes

RemoteProcedures.setUserResume = async (userID, base64resume, resumeFilename) => {
resumeFilename = path.parse(resumeFilename).base; // make sure this isn't a path
const userResumePath = getUserResumePath(userID);
if (!existsSync(userResumePath)) {
await fs.mkdir(userResumePath, {recursive: true});
} else {
const files = await fs.readdir(userResumePath);
await Promise.all(
files.map((f) => fs.unlink(path.resolve(userResumePath, f)))
);
}
if (base64resume){
const userResumeFilePath = path.join(userResumePath, resumeFilename || "untitled.pdf");
const bufferData = Buffer.from(base64resume, 'base64');
await fs.writeFile(userResumeFilePath, bufferData);
}
};
}

@Struck713 Struck713 self-assigned this Mar 7, 2024
@toBeOfUse
Copy link
Contributor

This is noble. The base64 string method was the easiest way to set up uploads quickly because I could pass the string to a remult "backend method" instead of setting up an actual Express route/endpoint, but it's non-standard and inefficient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants