moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
292 stars 118 forks source link

Missing interface when upload file. #324

Open ThienLK1 opened 1 year ago

ThienLK1 commented 1 year ago

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 commented 1 year ago

@icebob pls take a look.

icebob commented 1 year ago

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.