preallocateSpace(for:at:length:flags:replyHandler:)
Prealocates disk space for the given item.
Declaration
func preallocateSpace(for item: FSItem, at offset: off_t, length: Int, flags: FSVolume.PreallocateFlags, replyHandler reply: @escaping @Sendable (Int, (any Error)?) -> Void)func preallocateSpace(for item: FSItem, at offset: off_t, length: Int, flags: FSVolume.PreallocateFlags) async throws -> IntParameters
- item:
The item for which to preallocate space.
- offset:
The offset from which to allocate.
- length:
The length of the space in bytes.
- flags:
Flags that affect the preallocation behavior.
- reply:
A block or closure to indicate success or failure. If preallocation succeeds, pass the amount of bytes allocated and a
nilerror. If preallocation fails, pass the relevant error as the second parameter; FSKit ignores any byte count in this case. For anasyncSwift implementation, there’s no reply handler; simply return the allocated byte count or throw an error.