blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
745 B
25 lines
745 B
3 years ago
|
#!/usr/bin/env swift
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
let selectedCompressionAlgorithm = NSData.CompressionAlgorithm.lzma
|
||
|
|
||
|
func compressChainFile(inputFileName: String, outputFileName: String) throws {
|
||
|
let inputFileHandle = FileHandle(forReadingAtPath: inputFileName)!
|
||
|
let inputData = inputFileHandle.readDataToEndOfFile() as NSData
|
||
|
let outputData = try inputData.compressed(using: selectedCompressionAlgorithm) as Data
|
||
|
FileManager.default.createFile(atPath: outputFileName, contents: outputData, attributes: nil)
|
||
|
try inputFileHandle.close()
|
||
|
}
|
||
|
|
||
|
do {
|
||
|
try compressChainFile(inputFileName: "scripts/chains.json", outputFileName: "scripts/chains.json.zip")
|
||
|
exit(0)
|
||
|
} catch {
|
||
|
print("An error occurred: \(error)")
|
||
|
exit(-1)
|
||
|
}
|
||
|
|
||
|
|
||
|
|