export method

Archive export()
inherited

Implementation

Archive export() {
  if (!state.isDirty) {
    return this.archive;
  }
  final archive = Archive();
  for (final entry in state.added.entries) {
    archive.addFile(ArchiveFile(entry.key, entry.value.length, entry.value));
  }
  for (final file in this.archive) {
    if (state.removed.contains(file.name) ||
        state.added.containsKey(file.name)) {
      continue;
    }
    if (file.isDirectory) {
      archive.addFile(ArchiveFile.directory(file.name));
    } else if (file.isFile) {
      archive.addFile(ArchiveFile.bytes(file.name, file.content));
    }
  }
  return archive;
}