lib: add fileContents function

wip/yesman
Eric Sagnes 8 years ago
parent 0804f67024
commit 56575cc0ac
  1. 10
      lib/strings.nix

@ -479,4 +479,14 @@ rec {
absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths;
in
absolutePaths;
/* Read the contents of a file removing the trailing \n
Example:
$ echo "1.0" > ./version
fileContents ./version
=> "1.0"
*/
fileContents = file: removeSuffix "\n" (builtins.readFile file);
}

Loading…
Cancel
Save