writeZipFile static method

Future<void> writeZipFile({
  1. required CommandLogger logger,
  2. required String outputPath,
  3. required List<int> projectZip,
})

Writes projectZip to outputPath.

Throws FailureException if the file could not be written.

Implementation

static Future<void> writeZipFile({
  required CommandLogger logger,
  required String outputPath,
  required List<int> projectZip,
}) async {
  await logger.progress(
    'Writing zip file to $outputPath',
    padRight: StatusCommands.progressMessagePadLength,
    () async {
      try {
        final file = File(outputPath);
        await file.writeAsBytes(projectZip);
        return true;
      } on Exception catch (e, stackTrace) {
        throw FailureException.nested(
          e,
          stackTrace,
          'Failed to write zip file to $outputPath',
        );
      }
    },
  );
}