![]() |
![]()
| ![]() |
![]()
NAMEdirenv fetchurl - Fetch a URL to disk SYNOPSISdirenv fetchurl [] DESCRIPTIONThis command downloads the given URL into a fixed disk location, based on the content of the retrieved file. This has been introduced to avoid a dependency on curl or wget, while also promoting a more secure way to fetch data from the Internet. Use this instead of curl <url> | sh. This command has two modes of operation:
Since the on-disk location is based on the hash, it also acts as a cache. One implication of this design is that URLs must be stable and always return the same content. Downloaded files are marked as read-only and executable so it can also be used to fetch and execute static binaries. OPTIONS A HTTP URL that returns content on HTTP GET requests. 301 and
other
OUTPUTdirenv fetchurl outputs different content based on the argument. If the integrity-hash is being passed, it will output the path to the on-disk location, if the retrieval was successful. If only the url is being passed, it will output the hash as well as some human-readable instruction. If stdout is not a tty, only the hash will be displayed. EXAMPLE$ ./direnv fetchurl https://releases.nixos.org/nix/nix-2.3.7/install Found hash: sha256-7Gxl5GzI9juc/U30Igh/pY+p6+gj5Waohfwql3jHIds= Invoke fetchurl again with the hash as an argument to get the disk location: ENVIRONMENT VARIABLESXDG_CACHE_HOME
COPYRIGHTMIT licence - Copyright (C) 2019 @zimbatm and contributors SEE ALSOdirenv-stdlib(1)
|