question 1:
FileReaderreadAsArrayBufferMongodbArrayBufferMongodb
if(!isinArray(alreadychunks,curindex)) {
let tempcell = {
data: null,
n: 0,
file_id: summary,
username: username,
length: 0
};
tempcell.length = end - start;
filder[curindex] = new FileReader();
filder[curindex].readAsArrayBuffer(file.slice(start, end));
filder[curindex].onload = function () {
tempcell.n = curindex;
tempcell.data = filder[curindex].result
//chunk
chunksarrpromise.push(uploading("chunks", tempcell, chunksurl));
}
}
question 2:
:
MongodbNode.js
:
(1)
filder[curindex].readAsText(file.slice(start, end),"gb2312")
Node.js:
let req = http.request(options, function (res) {
res.on("data", function (chunk) {
let myoption = {
flags: "r+",
start: i * obj.chunkSize
};
let writeStream = fs.createWriteStream(obj.filename, myoption);
writeStream.write(chunk)
(2)
Node.jsReadASDataUrl,base6
base64
I hope all code friends will not hesitate to comment