0
我試圖截斷FileEntry
內容,但在嘗試執行任何與截斷有關的任何操作時(fileWriter.truncate(0)
),在cordova.js(@ 989:9) - Error: exec proxy not found for :: File :: truncate
中得到此錯誤,無論是或在seek
之前。 FileEntry/FileWriter存在,我很好寫它。Cordova - 截斷文件代理未找到
我用科爾多瓦6.1.1
每請求時,一些代碼(這個存在的文件類中):
this.__write__ = function(fileEntry, dataObj) {
console.log("Attempting to write", dataObj);
fileEntry.createWriter(function (fileWriter) {
fileWriter.onwriteend = function() {
fileWriter.write(dataObj);
fileWriter.onwriteend = function() {
console.log("Successfully written to "+self.filename, dataObj);
if (params.onwrite)
params.onwrite.apply(self)
};
fileWriter.onerror = function (e) {
throw new Error("Failed to write to "+self.filename, e.toString());
};
// If data object is not passed in,
// create a new Blob instead.
if (!dataObj)
dataObj = new Blob([''], { type: 'text/plain' });
}
fileWriter.truncate(0);
}, function(){
throw new Error("Failed to create write on "+self.filename);
});
}
如果我添加truncate(0)
fileWriter.write(dataObj);
之前,我得到上述錯誤
你能像樣本代碼一樣發佈更多細節嗎?你在android棉花糖上測試這個嗎? – Gandhi
@Gandhi - 我正在使用'cordova run browser'在瀏覽器上測試它, – eithed
你使用哪個版本的文件插件?正如我可以看到類似的問題已得到解決在文件插件版本4.1.0檢查此鏈接 - https://issues.apache.org/jira/browse/CB-10023 – Gandhi