File size: 843 Bytes
e94100d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import zipfile

from toolbox.to_markdown.common.params import Params


class BaseToMarkdown(Params):
    def __init__(self, filename: str):
        self.filename = filename

    def get_md_text(self, *args, **kwargs):
        raise NotImplementedError

    @staticmethod
    def zip_directory(src_dir, output_zip):
        with zipfile.ZipFile(output_zip, "w", zipfile.ZIP_DEFLATED) as f:
            for root, dirs, files in os.walk(src_dir):
                for file in files:
                    file_path = os.path.join(root, file)
                    arc_name = os.path.relpath(file_path, start=src_dir)
                    f.write(file_path, arcname=arc_name)

    def save_to_zip(self, output_dir: str) -> str:
        raise NotImplementedError


if __name__ == "__main__":
    pass