Add support for brotli compression
Build logs on cache.nixos.org are compressed using Brotli (since this allows them to be decompressed automatically by Chrome and Firefox), so it's handy if "nix log" can decompress them.
This commit is contained in:
		
							parent
							
								
									73d7a51ee6
								
							
						
					
					
						commit
						e8186085e0
					
				
					 7 changed files with 38 additions and 5 deletions
				
			
		|  | @ -89,6 +89,11 @@ static ref<std::string> decompressBzip2(const std::string & in) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| static ref<std::string> decompressBrotli(const std::string & in) | ||||
| { | ||||
|     return make_ref<std::string>(runProgram(BRO, true, {"-d"}, in)); | ||||
| } | ||||
| 
 | ||||
| ref<std::string> compress(const std::string & method, const std::string & in) | ||||
| { | ||||
|     StringSink ssink; | ||||
|  | @ -106,6 +111,8 @@ ref<std::string> decompress(const std::string & method, const std::string & in) | |||
|         return decompressXZ(in); | ||||
|     else if (method == "bzip2") | ||||
|         return decompressBzip2(in); | ||||
|     else if (method == "br") | ||||
|         return decompressBrotli(in); | ||||
|     else | ||||
|         throw UnknownCompressionMethod(format("unknown compression method ‘%s’") % method); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue