mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Add builtins.hashFile
For text files it is possible to do it like so: `builtins.hashString "sha256" (builtins.readFile /tmp/a)` but that doesn't work for binary files. With builtins.hashFile any kind of file can be conveniently hashed.
This commit is contained in:
parent
f9a2ea4486
commit
3f192ac80c
9 changed files with 39 additions and 1 deletions
|
@ -705,6 +705,19 @@ builtins.genList (x: x * x) 5
|
|||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id='builtin-hashFile'>
|
||||
<term><function>builtins.hashFile</function>
|
||||
<replaceable>type</replaceable> <replaceable>p</replaceable></term>
|
||||
|
||||
<listitem><para>Return a base-16 representation of the
|
||||
cryptographic hash of the file at path <replaceable>p</replaceable>. The
|
||||
hash algorithm specified by <replaceable>type</replaceable> must
|
||||
be one of <literal>"md5"</literal>, <literal>"sha1"</literal>,
|
||||
<literal>"sha256"</literal> or <literal>"sha512"</literal>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id='builtin-head'>
|
||||
<term><function>builtins.head</function>
|
||||
<replaceable>list</replaceable></term>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue