在Dartlang中下载大文件 [英] Download large files in Dartlang

查看:140
本文介绍了在Dartlang中下载大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用dartlang从浏览器下载largish文件。

I need to download largish files from a browser using dartlang.

我一直在使用data:uri该方法的局限性。

I've been using the "data:uri" thing to download, but have hit the size limitations of that method.

想知道什么是最好的方法,我研究了使用HTML5文件系统API,但是已经弃用了(大多数浏览器显然没有实现。

Wondering what the best method for this is, I looked into using the HTML5 filesystem API but that is deprecated (without ever really being implemented in most browsers apparently.

推荐答案

<a id='downloadLink' href='javascript:void(0)' download='Hello.txt'>Download</a>







import 'dart:html';

void main() {
  var data = new Blob(['Hello World!\n'*1000000]);
  querySelector("#downloadLink")
      ..setAttribute('href', Url.createObjectUrl(data));
}

这篇关于在Dartlang中下载大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆