我試圖從一個用戶發送word文檔到另一個使用peer.js 它很好地處理文本文件(.txt,text/plain)永遠在word文檔我沒有得到內容。關於「ondrop」事件將word文檔轉換爲文本或使用javascript的字符串
這裏是我做了什麼至今
box.on('drop', function (e) {
e.originalEvent.preventDefault();
var file = e.originalEvent.dataTransfer.files[0];
eachActiveConnection(function (c, $c) {
if (c.label === 'file') {
if (file.type == "text/plain") {
alert("type : " + file.type + " - sendable");
c.send(file);
} else {
//here i need to convert word document into text/plain or atleast to string and send the file by using // c.send(file)
}
請有人幫忙,我想獲得文件內的內容,即使它是word文檔 – Arjun