function openSync( path, flags, mode ) {
	var nargs;
	var fd;

	nargs = arguments.length;
	try {
		if ( nargs === 1 ) {
			fd = open( path, defaults.flags, defaults.mode );
		} else if ( nargs === 2 ) {
			fd = open( path, flags, defaults.mode );
		} else {
			fd = open( path, flags, mode );
		}
	} catch ( err ) {
		return err;
	}
	return fd;
}
Synchronously opens a file.

@param {(string|Buffer)} path - file path
@param {(string|number)} [flags='r'] - file system flags
@param {integer} [mode=0o666] - file mode
@returns {(integer|Error)} file descriptor or an error

@example
var closeSync = require( '@stdlib/fs/close' ).sync;

var fd = openSync( __filename );
if ( fd instanceof Error ) {
    throw fd;
}
closeSync( fd );