#[RESOLVED] Upload
13 messages · Page 1 of 1 (latest)
in memory
it will be available in the variable file
i can upload it on mongodb?
By following the docs, it uses MulterModule: https://docs.nestjs.com/techniques/file-upload#default-options, and when not provided, it defaults to expressjs/multer defaults: https://github.com/expressjs/multer#multeropts, which says:
In case you omit the options object, the files will be kept in memory and never written to disk.
That's for the where is the file uploaded - by default only to a memory.
You can get it from the file.buffer, with which you can do anything you want.
Storing files in databases is usually not the best idea, but it can be done.
but on restart it's deleted?
and for get file?
More like “forgotten”, since it wasn’t saved somewhere to be deleted in the first place, but yes.
Is there any way not to delete it on reboot of nest
You either set the “dest” option as documented in nest docs, or save the file manually, which you can find how by googling “node.js save file from buffer”
i can follow this https://docs.nestjs.com/techniques/file-upload#basic-example and add database logics
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Thank you for support