__setitem__#

barecat.Barecat.__setitem__(path, content)[source]#

Add a file to the Barecat archive.

Parameters:
  • path (str) – Path to the file within the archive.

  • content (Union[bytes, Any]) – Contents of the file. Either raw bytes, or an object to be encoded based on the file extension, if auto_codec was True in the constructor, or if codecs have been registered for the file extension via register_codec().

Raises:

Examples

>>> bc = Barecat('test.barecat', readonly=False)
>>> bc['file.txt'] = b'Hello, world!'
>>> bc['file.txt']
b'Hello, world!'