os.tmpDir() is deprecated - node and formidable

Fluffy picture Fluffy · Dec 1, 2016 · Viewed 23.4k times · Source

I use node version 7.2.0 and formidable version 1.0.17 for file upload. After updating to the node version 7.2.0 I now get the following error when uploading files:

(node:3376) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

I don't use the default of form.uploadDir but some custom path.

How would I fix that error?

Answer

Luis Roberto picture Luis Roberto · Nov 17, 2017

@idbehold, it worked like a charm.

It's not really an error, it's a deprecation warning. You can ask the formidable maintainers to fix it or you could just put something like the following at the top of your file:

var os = require('os');

os.tmpDir = os.tmpdir;