14 lines
373 B
Python
Raw Normal View History

#! /usr/bin/python
2010-02-26 01:14:33 -07:00
from allmydata.storage.mutable import MutableShareFile
from allmydata.storage.immutable import ShareFile
def get_share_file(filename):
2019-12-21 00:03:38 -07:00
with open(filename, "rb") as f:
prefix = f.read(32)
if prefix == MutableShareFile.MAGIC:
return MutableShareFile(filename)
# otherwise assume it's immutable
return ShareFile(filename)