#[RESOLVED] Upload

13 messages · Page 1 of 1 (latest)

delicate flame
potent musk
#

in memory
it will be available in the variable file

delicate flame
#

i can upload it on mongodb?

potent musk
#

why not

#

it's just nodejs

rancid lantern
#

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.

delicate flame
#

and for get file?

rancid lantern
#

More like “forgotten”, since it wasn’t saved somewhere to be deleted in the first place, but yes.

delicate flame
#

Is there any way not to delete it on reboot of nest

rancid lantern
#

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”

delicate flame
delicate flame
#

Thank you for support