code: def stream_directory(directory,
                       recursive=False,
                       patterns='**',
                       chunk_size=default_chunk_size):
      
      stream = DirectoryStream(directory,
                               recursive=recursive,
                               patterns=patterns,
                               chunk_size=chunk_size)
  
      return stream.body(), stream.headers
docs: Gets a buffered generator for streaming directories.
  
      Returns a buffered generator which encodes a directory as
      :mimetype:`multipart/form-data` with the corresponding headers.
  
      Parameters
      ----------
      directory : str
          The filepath of the directory to stream
      recursive : bool
          Stream all content within the directory recursively?
      patterns : str | list
          Single *glob* pattern or list of *glob* patterns and compiled
          regular expressions to match the names of the filepaths to keep
      chunk_size : int
          Maximum size of each stream chunk