StreamSaver实现浏览器中文件下载效果代码

代码语言:html

所属分类:其他

代码描述:StreamSaver实现浏览器中文件下载效果代码

代码标签: StreamSaver 浏览器 文件 下载

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/StreamSaver.2.0.3.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/web-streams-polyfill.2.0.2.js"></script>
</head>

<body>


    <script>
        let manual=true;
        
          const uInt8 = new TextEncoder().encode('StreamSaver is awesome')
        
          // streamSaver.createWriteStream() returns a writable byte stream
          // The WritableStream only accepts Uint8Array chunks
          // (no other typed arrays, arrayBuffers or strings are allowed)
          const fileStream = streamSav.........完整代码请登录后点击上方下载按钮下载查看

网友评论0