Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing interface when upload file. #324

Open
ThienLK1 opened this issue May 9, 2023 · 2 comments
Open

Missing interface when upload file. #324

ThienLK1 opened this issue May 9, 2023 · 2 comments

Comments

@ThienLK1
Copy link

ThienLK1 commented May 9, 2023

im trying to define a upload file api just like on example.
{ path: '/upload', bodyParsers: { json: false, urlencoded: false, }, aliases: { // File upload from HTML form 'POST /photos': 'multipart:v1.file.save', }, busboyConfig: { limits: { files: 1, fileSize: 10000000, }, }, mappingPolicy: 'restrict', },

but when get ctx.param only got:

ctx.params { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: null, ended: false, endEmitted: false, .........
it lead me to error like TypeError: stream.on is not a function

I found some interface like FileStream interface is missing, i no idea why it happen.

@ThienLK1
Copy link
Author

ThienLK1 commented May 9, 2023

@icebob pls take a look.

@icebob
Copy link
Member

icebob commented May 21, 2023

If you upload a file, the ctx.params will contain a Node.js Stream instance. It works, you can find example code here and here. If you think you find an issue, please create a repro example on repl.it or codesandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants