Skip to content

Commit bcb5260

Browse files
committed
docs: improve File Upload and Download example
1 parent 1f55145 commit bcb5260

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

apps/content/docs/file-upload-download.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ import { os } from '@orpc/server'
2222
import * as z from 'zod'
2323
// ---cut---
2424
const example = os
25-
.input(z.object({ file: z.file() }))
26-
.output(z.instanceof(File))
25+
.input(z.file())
26+
.output(z.object({ anyFieldName: z.instanceof(File) }))
2727
.handler(async ({ input }) => {
28-
console.log(input.file.name)
28+
const file = input
2929

30-
return new File(['Hello World'], 'hello.txt', { type: 'text/plain' })
30+
console.log(file.name)
31+
32+
return {
33+
anyFieldName: new File(['Hello World'], 'hello.txt', { type: 'text/plain' }),
34+
}
3135
})
3236
```

0 commit comments

Comments
 (0)