Updated script that can be controled by Nodejs web app
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
|
||||
class LinuxZipFileWithPermissions(zipfile.ZipFile):
|
||||
"""Class for extract files in linux with right permissions"""
|
||||
|
||||
def extract(self, member, path=None, pwd=None):
|
||||
if not isinstance(member, zipfile.ZipInfo):
|
||||
member = self.getinfo(member)
|
||||
|
||||
if path is None:
|
||||
path = os.getcwd()
|
||||
|
||||
ret_val = self._extract_member(member, path, pwd) # noqa
|
||||
attr = member.external_attr >> 16
|
||||
os.chmod(ret_val, attr)
|
||||
return ret_val
|
||||
|
||||
|
||||
class Archive(object):
|
||||
def __init__(self, path: str):
|
||||
self.file_path = path
|
Reference in New Issue
Block a user