addFile method

Future<void> addFile(
  1. File file, [
  2. String? filename
])

Implementation

Future<void> addFile(File file, [String? filename]) async {
  final fileStream = InputFileStream(file.path);
  final f =
      ArchiveFile.stream(filename ?? path.basename(file.path), fileStream);
  f.lastModTime = (await file.lastModified()).millisecondsSinceEpoch ~/ 1000;
  f.mode = (await file.stat()).mode;
  _encoder.add(f);
  await fileStream.close();
}