writer¶
-
class
PimarcWriter
(archive_filename, mode='w')[source]¶ Bases:
object
The Pimlico Archive format: writing new archives or appending existing ones.
-
static
delete
(archive_filename)[source]¶ Delete all files associated with the given archive. At the moment, this is just the archive file itself and the associated index.
-
write_file
(data, name=None, metadata=None)[source]¶ Append a write to the end of the archive. The metadata should be a dictionary that can be encoded as JSON (which is how it will be stored). The data should be a bytes object.
If you want to write text files, you should encode the text as UTF-8 to get a bytes object and write that.
Setting name=X is simply a shorthand for setting metadata[“name”]=X. Either name or a metadata dict including the name key is required.
-
static