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), file.lengthSync(), fileStream);
  f.lastModTime = file.lastModifiedSync().millisecondsSinceEpoch ~/ 1000;
  f.mode = file.statSync().mode;
  _encoder.add(f);
  await fileStream.close();
}