lookupItem(name:in:packer:replyHandler:)
Looks up an item within a directory and maps its disk space.
Declaration
func lookupItem(name: FSFileName, in directory: FSItem, packer: FSExtentPacker, replyHandler reply: @escaping @Sendable (FSItem?, FSFileName?, (any Error)?) -> Void)func lookupItem(name: FSFileName, in directory: FSItem, packer: FSExtentPacker) async throws -> (FSItem, FSFileName)Parameters
- name:
The name of the file to look up.
- directory:
The directory in which to look up the file.
- packer:
An extent packer you use to pack the file’s allocated disk space.
- reply:
A block or closure to indicate success or failure. If lookup succeeds, pass the found Fsitem and its Fsfilename, along with a
nilerror. If lookup fails, pass the relevant error as the third parameter; FSKit ignores any Fsitem or Fsfilename in this case. For anasyncSwift implementation, there’s no reply handler; instead, return a tuple of the Fsitem and its Fsfilename or throw an error.
Discussion
This method allows the module to opportunistically supply extents, avoiding future calls to blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:). Only perform this technique opportunistically. In particular, don’t perform additional I/O to fetch extent data.