Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
export const editFileName = (req, file, callback) => {
const name = file.originalname.split('.')[0];
const fileExtName = extname(file.originalname);
const randomName = Array(4)
.map(() => Math.round(Math.random() * 16).toString(16))
callback(null, `${name}-${randomName}${fileExtName}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.