import 'package:universal_html/html.dart' as html;
import 'dart:typed_data';

class DownloadFileInWeb {
  static downloadFromUrl(String url, String fileName) {
    html.AnchorElement(href: url)
      ..setAttribute("download", fileName)
      ..click();
  }

  static download(Uint8List uint8List, String fileName) {
    final blob = html.Blob([uint8List]);
    final url = html.Url.createObjectUrlFromBlob(blob);
    downloadFromUrl(url, fileName);
  }
}
