diff --git a/lib/tmp.js b/lib/tmp.js index 4ce81dd..ba6728a 100644 --- a/lib/tmp.js +++ b/lib/tmp.js @@ -10,10 +10,13 @@ * Module dependencies. */ const fs = require('fs'); +const os = require('os'); const path = require('path'); const crypto = require('crypto'); const osTmpDir = require('os-tmpdir'); -const _c = process.binding('constants'); +const _c = fs.constants && os.constants ? + { fs: fs.constants, os: os.constants } : + process.binding('constants'); /* * The working inner variables. @@ -289,7 +292,7 @@ function fileSync(options) { var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); /* istanbul ignore else */ if (opts.discardDescriptor) { - fs.closeSync(fd); + fs.closeSync(fd); fd = undefined; }