happy-opfs
    Preparing search index...

    Function zip

    • Zip a file or directory and write to a zip file. Equivalent to zip -r <zipFilePath> <sourcePath>.

      Use fflate as the zip backend.

      Parameters

      • sourcePath: string

        The path to be zipped.

      • zipFilePath: string

        The path to the zip file.

      • Optionaloptions: ZipOptions

        Options of zip.

      Returns AsyncVoidIOResult

      A promise that resolves to an AsyncIOResult indicating whether the source was successfully zipped.

      1.6.0

      • zipSync for synchronous version
      • zipStream for streaming version (better for large files)
      • unzip for the reverse operation
      // Zip a directory to a file
      (await zip('/documents', '/backups/documents.zip'))
      .inspect(() => console.log('Directory zipped successfully'));
    • Zip a file or directory and return the zip file data. Equivalent to zip -r <zipFilePath> <sourcePath>.

      Use fflate as the zip backend.

      Parameters

      • sourcePath: string

        The path to be zipped.

      • Optionaloptions: ZipOptions

        Options of zip.

      Returns AsyncIOResult<Uint8Array<ArrayBuffer>>

      A promise that resolves to an AsyncIOResult indicating whether the source was successfully zipped.

      1.6.0

      • zipSync for synchronous version
      • zipStream for streaming version (better for large files)
      • unzip for the reverse operation
      // Zip a directory and get the data
      (await zip('/documents'))
      .inspect(zipData => console.log(`Zip size: ${ zipData.byteLength } bytes`));