def listdir_iter(self, path="<STR_LIT:.>", read_aheads=<NUM_LIT:50>):
path = self._adjust_cwd(path)<EOL>self._log(DEBUG, "<STR_LIT>".format(path))<EOL>t, msg = self._request(CMD_OPENDIR, path)<EOL>if t != CMD_HANDLE:<EOL><INDENT>raise SFTPError("<STR_LIT>")<EOL><DEDENT>handle = msg.get_string()<EOL>nums = list()<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>for i in range(read_aheads):<EOL><INDENT>num = self._async_request(type(None), CMD_READDIR, handle)<EOL>nums.append(num)<EOL><DEDENT>for num in nums:<EOL><INDENT>t, pkt_data = self._read_packet()<EOL>msg = Message(pkt_data)<EOL>new_num = msg.get_int()<EOL>if num == new_num:<EOL><INDENT>if t == CMD_STATUS:<EOL><INDENT>self._convert_status(msg)<EOL><DEDENT><DEDENT>count = msg.get_int()<EOL>for i in range(count):<EOL><INDENT>filename = msg.get_text()<EOL>longname = msg.get_text()<EOL>attr = SFTPAttributes._from_msg(<EOL>msg, filename, longname<EOL>)<EOL>if (filename != "<STR_LIT:.>") and (filename != "<STR_LIT:..>"):<EOL><INDENT>yield attr<EOL><DEDENT><DEDENT><DEDENT>nums = list()<EOL><DEDENT>except EOFError:<EOL><INDENT>self._request(CMD_CLOSE, handle)<EOL>return<EOL><DEDENT><DEDENT>
Generator version of `.listdir_attr`.

See the API docs for `.listdir_attr` for overall details.

This function adds one more kwarg on top of `.listdir_attr`:
``read_aheads``, an integer controlling how many
``SSH_FXP_READDIR`` requests are made to the server. The default of 50
should suffice for most file listings as each request/response cycle
may contain multiple files (dependent on server implementation.)

.. versionadded:: 1.15