4466ba436b
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
22 lines
507 B
TypeScript
22 lines
507 B
TypeScript
"use server";
|
|
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { promisify } from "util";
|
|
|
|
const writeFile = promisify(fs.writeFile);
|
|
|
|
export async function saveData(formData: FormData) {
|
|
const file = formData.get("file") as File;
|
|
const fileBuffer = await file.arrayBuffer();
|
|
const filePath = path.join(`/tmp/${file.name}`);
|
|
await writeFile(filePath, Buffer.from(fileBuffer));
|
|
|
|
const payload = {
|
|
email: formData.get("email"),
|
|
};
|
|
|
|
console.log("payload", payload);
|
|
|
|
return payload;
|
|
}
|