payload
Version:
Node, React, Headless CMS and Application Framework built on Next.js
14 lines (13 loc) • 449 B
JavaScript
import { FileUploadError } from '../errors/index.js';
import saveBufferToFile from './saveBufferToFile.js';
export const uploadFiles = async (payload, files, req)=>{
try {
await Promise.all(files.map(async ({ buffer, path })=>{
await saveBufferToFile(buffer, path);
}));
} catch (err) {
payload.logger.error(err);
throw new FileUploadError(req.t);
}
};
//# sourceMappingURL=uploadFiles.js.map