function fileSync(options) {
  var
    args = _parseArguments(options),
    opts = args[0];

  opts.postfix = opts.postfix || '.tmp';

  const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
  const name = tmpNameSync(opts);
  var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
  if (opts.discardDescriptor) {
    fs.closeSync(fd); 
    fd = undefined;
  }

  return {
    name: name,
    fd: fd,
    removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
  };
}
/**
 * Synchronous version of file.
 *
 * @param {Options} options
 * @returns {FileSyncObject} object consists of name, fd and removeCallback
 * @throws {Error} if cannot create a file
 */
Synchronous version of file.
@param {Options} options
@returns {FileSyncObject} object consists of name, fd and removeCallback
@throws {Error} if cannot create a file
Synchronous version of file . @param { Options } options @returns { FileSyncObject } object consists of name fd and removeCallback @throws { Error } if cannot create a file
function fileSync(options) {
  var
    args = _parseArguments(options),
    opts = args[0];
  opts.postfix = opts.postfix || '.tmp';
  const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
  const name = tmpNameSync(opts);
  var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
  if (opts.discardDescriptor) {
    fs.closeSync(fd); 
    fd = undefined;
  }
  return {
    name: name,
    fd: fd,
    removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
  };
}
function fileSync ( options ) { var args = _parseArguments ( options ) , opts = args [ 0 ] ; opts . postfix = opts . postfix || '.tmp' ; const discardOrDetachDescriptor = opts . discardDescriptor || opts . detachDescriptor ; const name = tmpNameSync ( opts ) ; var fd = fs . openSync ( name , CREATE_FLAGS , opts . mode || FILE_MODE ) ; if ( opts . discardDescriptor ) { fs . closeSync ( fd ) ; fd = undefined ; } return { name : name , fd : fd , removeCallback : _prepareTmpFileRemoveCallback ( name , discardOrDetachDescriptor ? - 1 : fd , opts ) } ; }
Synchronous version of file.
Synchronous version of file .