Implement memory-efficient approaches to prevent stack overflows when handling large directory structures: - Rewrite the unpack function to use a fully iterative approach instead of recursion - Modify the pack function to use heap-allocated buffers instead of stack-allocated ones - Reduce buffer sizes to avoid large memory allocations