123456789101112131415161718192021222324 |
- import sqlite3
- import os
- con = sqlite3.connect('cache.db')
- con.row_factory = sqlite3.Row
- def write_file(row):
- filename = "./blobs/{}.dif".format(row["hash"][:40])
- print(filename)
- with open(filename, "wb") as f:
- f.write(row["data"])
- try:
- os.mkdir('blobs')
- except FileExistsError:
- pass
- cursor = con.execute("select * from blobs")
- for row in cursor.fetchall():
- write_file(row)
|