File sending on form submit

So I'm trying to make a mutation, and that should generate a txt file and send back to the user. So far I have this
import { z } from "zod";
import fs from "fs";

import { router, publicProcedure } from "../trpc";

export const fileRouter = router({
get: publicProcedure
.input(z.object({ navn: z.string(), email: z.string().email() }))
.mutation(({ input }) => {
const file = fs.writeFileSync("name.txt", input.navn + " " + input.email);
return {
file,
};
}),
});
import { z } from "zod";
import fs from "fs";

import { router, publicProcedure } from "../trpc";

export const fileRouter = router({
get: publicProcedure
.input(z.object({ navn: z.string(), email: z.string().email() }))
.mutation(({ input }) => {
const file = fs.writeFileSync("name.txt", input.navn + " " + input.email);
return {
file,
};
}),
});
1 Reply
barry
barry2y ago
but obv doesnt work lol
Want results from more Discord servers?
Add your server