import StreamZip from 'node-stream-zip';
import { promises as fs } from 'fs';
import decompress from 'decompress'

export class ZipRepository {
    public async archive(outhPath: string, zipFile: Buffer, name='generation') {
        const entry = outhPath + 'archive.zip'
        await fs.writeFile(entry, zipFile)
        await decompress(entry, outhPath + name);
        fs.rm(entry)
        return outhPath + name
    }
}