We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5b1aa1 commit 594b25fCopy full SHA for 594b25f
shared/api-utils.ts
@@ -5,7 +5,15 @@ export async function respondWithDataTable(data: URLSearchParams | FormData) {
5
const headerCellStyle = `${cellStyle} border-bottom-width: 2px;`
6
7
async function stringifyValue(value: string | File) {
8
- if (value instanceof File) {
+ // this would be value instanceof File except the global File was not added until Node 20.
9
+ // feel free to update this when we drop Node 18 support after April 2025.
10
+ if (
11
+ typeof value === 'object' &&
12
+ 'size' in value &&
13
+ 'arrayBuffer' in value &&
14
+ 'type' in value &&
15
+ 'name' in value
16
+ ) {
17
if (value.size > MAX_FILE_SIZE) {
18
throw new Response(`File larger than ${MAX_FILE_SIZE} bytes`, {
19
status: 400,
0 commit comments