Chito Adinugraha
Chito Adinugraha

Reputation: 1320

Change nodejs temporary directory

I want to make file upload using nodejs, but fs.rename() cannot move a file between two different disks/partitions, I don't want to copy uploaded file from temporary directory. I want to change temporary directory so fs.rename() will work.

how can i do that? thanks!

Upvotes: 3

Views: 3846

Answers (1)

Ry-
Ry-

Reputation: 224922

The module responsible for that is formidable, and you can set uploadDir, as per the README:

form.uploadDir = "/my/dir";

Sets the directory for placing file uploads in. You can move them later on using fs.rename(). The default is os.tmpDir().

Upvotes: 3

Related Questions