Initializerswift-nio 2.72.0NIOCore
init(path:)
Open a new NIOFileHandle
. This operation is blocking.
convenience init(path: String) throws
Parameters
- path
The path of the file to open. The ownership of the file descriptor is transferred to this
NIOFileHandle
and so it will be closed onceclose
is called.
Other members in extension
Types
struct Flags
Flags
allows to specify additional flags toMode
, such as permission for file creation.struct Mode
Mode
represents file access modes.
Type members
init(descriptor: CInt
) Create a
NIOFileHandle
taking ownership ofdescriptor
. You must callNIOFileHandle.close
orNIOFileHandle.takeDescriptorOwnership
before this object can be safely released.init(path: String, mode: Mode, flags: Flags
) throws Open a new
NIOFileHandle
. This operation is blocking.
Instance members
var description: String
var isOpen: Bool
func close(
) throws func duplicate(
) throws -> NIOFileHandle Duplicates this
NIOFileHandle
. This means that a newNIOFileHandle
object with a new underlying file descriptor is returned. The caller takes ownership of the returnedNIOFileHandle
and is responsible for closing it.func takeDescriptorOwnership(
) throws -> CInt Take the ownership of the underlying file descriptor. This is similar to
close()
but the underlying file descriptor remains open. The caller is responsible for closing the file descriptor by some other means.func withUnsafeFileDescriptor<T>((CInt) throws -> T
) throws -> T