Replies: 4 comments
-
Or, at least, is there a way to access the underlying |
Beta Was this translation helpful? Give feedback.
-
Have you found a solution |
Beta Was this translation helpful? Give feedback.
-
Actually, I have! Feels a little hack-y, but it works. It involves getting the raw request payload, and parsing it ourselves. Here's a quick snippet, not a full example: // Using a multiparser elsewhere in the community
import { multiParser } from 'https://deno.land/x/multiparser/mod.ts'
// ...
router
.post('/upload', async (ctx, next) => {
const body = await ctx.request.body({
type: 'form-data'
})
const form = await multiParser(ctx.request.originalRequest.request)
const img = form.files['image-upload'].content
// ...
}) Here's a complete example: https://dash.deno.com/playground/jcs224-oak-zbar-multipart I still think this should be fixed within Oak, but this is a good enough workaround for now. |
Beta Was this translation helpful? Give feedback.
-
The type Lines 111 to 118 in 91b7aaa Try setting a
|
Beta Was this translation helpful? Give feedback.
-
This app works fine with the Deno CLI, but not Deno Deploy:
https://dash.deno.com/playground/jcs224-zbar-wasm-oak
The
multipart/form-data
file upload doesn't work because it's trying to runDeno.makeTempDir
and Deploy doesn't have the ability to write files.The failing line is 27,
const data = await body.value.read()
.Is there a way to get the multipart file data without writing a temp dir? I was able to do this with the web-native
FormData
without Oak:https://developer.mozilla.org/en-US/docs/Web/API/FormData/get
Beta Was this translation helpful? Give feedback.
All reactions