Skip to content

Commit

Permalink
learn
Browse files Browse the repository at this point in the history
  • Loading branch information
abstain23 committed Jun 12, 2020
1 parent 8e61780 commit 46fffe6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function run(gen) {
_next()
}
*/
// run(mtGenerator)
run(mtGenerator)

function run(gen) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -70,4 +70,4 @@ function* myGenerator() {
}

const result = run(myGenerator) //result是一个Promise
//输出 1 2 error
//输出 1 2 error
22 changes: 22 additions & 0 deletions 多文件上传测试/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type='file' id="file" multiple>
<button id="btn">上传</button>
<script>
var chunkSize=2*1024*1024
var file = document.getElementById('file'), btn = document.getElementById('btn')
var formData = new FormData()
btn.addEventListener('click', () => {
var fileItem = file.files[0]
var blob = fileItem.slice(0, chunkSize)
console.log(blob)
})
</script>
</body>
</html>

0 comments on commit 46fffe6

Please sign in to comment.