let fileManager = FileManager.default
let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
            
let fileDir = documentsURL.appendingPathComponent("download",isDirectory: true)
            
if !fileManager.fileExists(atPath: fileDir.path) {
	do {
		try fileManager.createDirectory(atPath: fileDir.path, withIntermediateDirectories: true)
	} catch {
		print("Couldn't create document directory!")
	}
}

let filePath = "\(filePath.path)/\(fileName)"
                
if FileManager.default.createFile(atPath: filePath, contents: data, attributes: nil) == true {
	log(direction: .ETC, ofType: self, datas: "IOS 14.5 미만 File Download Success!!", filePath)
	showPopup(message: "다운로드 완료!")
} else {
	log(direction: .ETC, ofType: self, datas: "IOS 14.5 미만 File Download Fail!!", filePath)
	showPopup(message: "다운로드 실패!")
}

+ Recent posts