我有以下功能
def get_files(paths):
for path in paths:
file_name = parse_path(path)
csv_command = "curl -b ./cookie {} > ./tmp/{}".format(path, file_name)
check_file_size(path)
subprocess.run([csv_command], shell=True, stdout=subprocess.DEVNULL)
print("success")
def check_file_size(path):
csv_command = "curl -sI ./cookie {}".format(path)
subprocess.run([csv_command], shell=True, stdout=subprocess.DEVNULL)
我目前能够从cookie下载和检索我要查找的文件。在下载文件之前,我想检查所述文件的大小并将其保存在内存中。我该怎么做?
无法通过cookie检查文件的大小。修复是在lambda端设置一个缓冲区限制,当尝试从cookie中读取文件时只读入缓冲区数量,如果文件大于缓冲区数量则引发错误。