@@ -78,6 +78,7 @@ def add_file_from_memory(
7878 self , entry_path , entry_size , entry_data ,
7979 filetype = REGULAR_FILE , permission = DEFAULT_UNIX_PERMISSION ,
8080 atime = None , mtime = None , ctime = None , birthtime = None ,
81+ uid = None , gid = None ,
8182 ):
8283 """"Add file from memory to archive.
8384
@@ -99,6 +100,8 @@ def add_file_from_memory(
99100 birthtime (int | Tuple[int]):
100101 the file's birth time (for archive formats that support it),
101102 in seconds or as a tuple (seconds, nanoseconds)
103+ uid (int): the file owner's identifier
104+ gid (int): the file group's identifier
102105 """
103106 archive_pointer = self ._pointer
104107
@@ -117,6 +120,11 @@ def add_file_from_memory(
117120 entry_set_filetype (archive_entry_pointer , filetype )
118121 entry_set_perm (archive_entry_pointer , permission )
119122
123+ if uid is not None :
124+ archive_entry .uid = uid
125+ if gid is not None :
126+ archive_entry .gid = gid
127+
120128 if atime is not None :
121129 if not isinstance (atime , tuple ):
122130 atime = (atime , 0 )
0 commit comments