(
			self, path: str, target: utils.path_t = ".",
			args: ty.Sequence[str] = [], *,
			opts: ty.Mapping[str, str] = {},
			compress: bool = False,
			offline: bool = False,
			auth: auth_t = None,
			cookies: cookies_t = None,
			data: reqdata_sync_t = None,
			headers: headers_t = None,
			timeout: timeout_t = None
	)
Downloads a directory from the IPFS daemon
		
		Downloads a file or files from IPFS into the current working
		directory, or the directory given by ``target``.
		
		Raises
		------
		~ipfshttpclient.exceptions.ErrorResponse
		~ipfshttpclient.exceptions.ConnectionError
		~ipfshttpclient.exceptions.ProtocolError
		~ipfshttpclient.exceptions.StatusError
		~ipfshttpclient.exceptions.TimeoutError
		
		Parameters
		----------
		path
			The command path relative to the given base
		target
			The local path where downloaded files should be stored at
			
			Defaults to the current working directory.
		args
			Positional parameters to be sent along with the HTTP request
		opts
			Query string parameters to be sent along with the HTTP request
		compress
			Whether the downloaded file should be GZip compressed by the
			daemon before being sent to the client
			
			This may greatly speed up things if data is sent across slower networks
			like the internet but is a major bottleneck when communicating with the
			daemon on ``localhost``.
		offline
			Whether to request to daemon to handle this request in “offline-mode”
		auth
			Authentication data to send along with this request as
			``(username, password)`` tuple
		cookies
			HTTP cookies to send along with each request to the API daemon
		data
			Iterable yielding data to stream from the client to the daemon
		headers
			Custom HTTP headers to pass send along with the request
		timeout
			How many seconds to wait for the server to send data
			before giving up
			
			Set this to :py:`math.inf` to disable timeouts entirely.
Downloads a directory from the IPFS daemon
		
		Downloads a file or files from IPFS into the current working
		directory, or the directory given by ``target``.
		
		Raises
		------
		~ipfshttpclient.exceptions.ErrorResponse
		~ipfshttpclient.exceptions.ConnectionError
		~ipfshttpclient.exceptions.ProtocolError
		~ipfshttpclient.exceptions.StatusError
		~ipfshttpclient.exceptions.TimeoutError
		
		Parameters
		----------
		path
			The command path relative to the given base
		target
			The local path where downloaded files should be stored at
			
			Defaults to the current working directory.
		args
			Positional parameters to be sent along with the HTTP request
		opts
			Query string parameters to be sent along with the HTTP request
		compress
			Whether the downloaded file should be GZip compressed by the
			daemon before being sent to the client
			
			This may greatly speed up things if data is sent across slower networks
			like the internet but is a major bottleneck when communicating with the
			daemon on ``localhost``.
		offline
			Whether to request to daemon to handle this request in “offline-mode”
		auth
			Authentication data to send along with this request as
			``(username, password)`` tuple
		cookies
			HTTP cookies to send along with each request to the API daemon
		data
			Iterable yielding data to stream from the client to the daemon
		headers
			Custom HTTP headers to pass send along with the request
		timeout
			How many seconds to wait for the server to send data
			before giving up
			
			Set this to :py:`math.inf` to disable timeouts entirely.
Downloads a directory from the IPFS daemon Downloads a file or files from IPFS into the current working directory or the directory given by target . Raises ------ ~ipfshttpclient . exceptions . ErrorResponse ~ipfshttpclient . exceptions . ConnectionError ~ipfshttpclient . exceptions . ProtocolError ~ipfshttpclient . exceptions . StatusError ~ipfshttpclient . exceptions . TimeoutError Parameters ---------- path The command path relative to the given base target The local path where downloaded files should be stored at Defaults to the current working directory . args Positional parameters to be sent along with the HTTP request opts Query string parameters to be sent along with the HTTP request compress Whether the downloaded file should be GZip compressed by the daemon before being sent to the client This may greatly speed up things if data is sent across slower networks like the internet but is a major bottleneck when communicating with the daemon on localhost . offline Whether to request to daemon to handle this request in “offline - mode” auth Authentication data to send along with this request as ( username password ) tuple cookies HTTP cookies to send along with each request to the API daemon data Iterable yielding data to stream from the client to the daemon headers Custom HTTP headers to pass send along with the request timeout How many seconds to wait for the server to send data before giving up Set this to : py : math . inf to disable timeouts entirely .
def download(
			self, path: str, target: utils.path_t = ".",
			args: ty.Sequence[str] = [], *,
			opts: ty.Mapping[str, str] = {},
			compress: bool = False,
			offline: bool = False,
			auth: auth_t = None,
			cookies: cookies_t = None,
			data: reqdata_sync_t = None,
			headers: headers_t = None,
			timeout: timeout_t = None
	) -> None:
		"""Downloads a directory from the IPFS daemon
		
		Downloads a file or files from IPFS into the current working
		directory, or the directory given by ``target``.
		
		Raises
		------
		~ipfshttpclient.exceptions.ErrorResponse
		~ipfshttpclient.exceptions.ConnectionError
		~ipfshttpclient.exceptions.ProtocolError
		~ipfshttpclient.exceptions.StatusError
		~ipfshttpclient.exceptions.TimeoutError
		
		Parameters
		----------
		path
			The command path relative to the given base
		target
			The local path where downloaded files should be stored at
			
			Defaults to the current working directory.
		args
			Positional parameters to be sent along with the HTTP request
		opts
			Query string parameters to be sent along with the HTTP request
		compress
			Whether the downloaded file should be GZip compressed by the
			daemon before being sent to the client
			
			This may greatly speed up things if data is sent across slower networks
			like the internet but is a major bottleneck when communicating with the
			daemon on ``localhost``.
		offline
			Whether to request to daemon to handle this request in “offline-mode”
		auth
			Authentication data to send along with this request as
			``(username, password)`` tuple
		cookies
			HTTP cookies to send along with each request to the API daemon
		data
			Iterable yielding data to stream from the client to the daemon
		headers
			Custom HTTP headers to pass send along with the request
		timeout
			How many seconds to wait for the server to send data
			before giving up
			
			Set this to :py:`math.inf` to disable timeouts entirely.
		"""
		opts2: ty.Dict[str, str] = dict(opts.items())
		opts2["archive"] = "true"
		opts2["compress"] = "true" if compress else "false"
		
		closables, res = self._request(
			"POST", path, map_args_to_params(args, opts2, offline=offline),
			auth=auth, data=data, headers=headers, timeout=timeout,
			chunk_size=tarfile.RECORDSIZE,
		)
		try:
			# try to stream download as a tar file stream
			mode = 'r|gz' if compress else 'r|'
			
			fileobj = ReadableStreamWrapper(res)  # type: ty.IO[bytes]  # type: ignore[assignment]
			with tarfile.open(fileobj=fileobj, mode=mode) as tf:
				tf.extractall(path=target)
		finally:
			for closable in closables:
				closable.close()
def download ( self , path : str , target : utils . path_t = "." , args : ty . Sequence [ str ] = [ ] , * , opts : ty . Mapping [ str , str ] = { } , compress : bool = False , offline : bool = False , auth : auth_t = None , cookies : cookies_t = None , data : reqdata_sync_t = None , headers : headers_t = None , timeout : timeout_t = None ) -> None : opts2 : ty . Dict [ str , str ] = dict ( opts . items ( ) ) opts2 [ "archive" ] = "true" opts2 [ "compress" ] = "true" if compress else "false" closables , res = self . _request ( "POST" , path , map_args_to_params ( args , opts2 , offline = offline ) , auth = auth , data = data , headers = headers , timeout = timeout , chunk_size = tarfile . RECORDSIZE , ) try : # try to stream download as a tar file stream mode = 'r|gz' if compress else 'r|' fileobj = ReadableStreamWrapper ( res ) # type: ty.IO[bytes]  # type: ignore[assignment] with tarfile . open ( fileobj = fileobj , mode = mode ) as tf : tf . extractall ( path = target ) finally : for closable in closables : closable . close ( )