def extract(self): """ Extracts a bz2 file. Opens the file for writing and meta pipe the contents bz2file to the new file. """ # Store all extracted files in a temporary directory. if ARCHIVE_UPLOAD_TEMPDIR.get(): directory = tempfile.mkdtemp(dir=ARCHIVE_UPLOAD_TEMPDIR.get()) else: directory = tempfile.mkdtemp() files = [self.name] self._create_files(directory, files) return directory
def extract(self): """ Extracts a zip file. If a 'file' ends with '/', then it is a directory and we must create it. Else, open a file for writing and meta pipe the contents zipfile to the new file. """ # Store all extracted files in a temporary directory. if ARCHIVE_UPLOAD_TEMPDIR.get(): directory = tempfile.mkdtemp(dir=ARCHIVE_UPLOAD_TEMPDIR.get()) else: directory = tempfile.mkdtemp() dirs, files = self._filenames() self._create_dirs(directory, dirs) self._create_files(directory, files) return directory