Function generateZipFile

  • Experimental

    Generates a ZIP file from an array of MwFile objects.

    Parameters

    • files: MwFile[]

      An array of MwFile objects to be included in the ZIP file.

    • OptionalfileName: string = 'archive.zip'

      The name of the generated ZIP file, default archive.zip.

    Returns Promise<MwFile>

    A promise that resolves to an MwFile object representing the generated ZIP file.

    const files = await showUploadFile(ctx, {
    fileUploadTitle: 'Upload a file',
    uploadButton: 'Upload',
    text: 'Upload a file to get started',
    minFileLimit: 2,
    maxFileLimit: 5,
    });
    if (!files) {
    return;
    }
    const zip = await generateZipFile(files);
    const filePath = path.join(os.homedir(), 'Downloads');
    await fileToDrive(zip, filePath);