【发布时间】:2015-02-25 03:51:34
【问题描述】:
我遵循了这个例子:
chrome.fileSystem.chooseEntry({type:'openDirectory'}, function(entry) {
chrome.fileSystem.getWritableEntry(entry, function(entry) {
entry.getFile('file1.txt', {create:true}, function(entry) {
entry.createWriter(function(writer) {
writer.write(new Blob(['Lorem'], {type: 'text/plain'}));
});
});
entry.getFile('file2.txt', {create:true}, function(entry) {
entry.createWriter(function(writer) {
writer.write(new Blob(['Ipsum'], {type: 'text/plain'}));
});
});
});
});
覆盖一些现有文件file1.txt 和file2.txt。
但是我发现一个问题:如果文件不为空,它们的内容不会被完全覆盖,只会覆盖开头部分。
我需要先删除文件吗?还是我错过了什么?
【问题讨论】:
标签: javascript google-chrome filesystems google-chrome-app filewriter