Comments (1)
I managed to start uploading large files by using multer
and callHanlder
:
@/server/api/upload.ts
import { CompatibilityEvent, callHandler } from 'h3';
import multer from 'multer';
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, './');
},
filename: (req, file, cb) => {
cb(null, file.originalname);
},
});
export default async (event: CompatibilityEvent): Promise<IServerResponse> => {
await callHandler(multer({ storage }).single('file'), event.req, event.res);
return { success: true };
};
It turns out all this time it worked just Typescript complains about types:
text:
An argument of type "RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>" cannot be assigned to a parameter of type "Middleware".
Parameter types "req" and "req" are incompatible.
The 'IncomingMessage' type is missing the following properties from the 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' type: get, header, accepts, acceptsCharsets and 25.ts(2345) more
from framework.
Related Issues (20)
- how to use obfuscator on nuxt3
- Accessibility of API return
- Migration to `nuxt/nuxt` HOT 1
- Dependency Dashboard
- [FEATURE REQUEST] Preview mode for Nuxt 3 HOT 1
- ContentResolver fails when using nuxt rc12 or newer HOT 1
- onResponseError
- about middleware and logs collection HOT 1
- Place of the nitro server in Techempower Web Framework Benchmarks HOT 1
- Postcss with Nuxt 3.0.0 HOT 1
- Never use browser cache in https access
- Playwright chromioum works in dev but fails on production
- How to get access localStorage Nuxt.config.ts version 3?
- How can i get the response headers on the client side? HOT 1
- How to add a cache policy HOT 1
- Help: How to use App.vue and wait for store to be ready through the app
- HMR won't connect behind reverse proxy with Firefox HOT 2
- Windows-IIS-Server
- vite watch is not working in node_modules directory. HOT 1
- Server directory documentation about SSR requests and performance with nuxt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.