H5+写文件

   var fileName="city.data.js";
plus.io.resolveLocalFileSystemURL('js/', function(entry) {
if (entry.isDirectory) {
entry.getFile(fileName, {
create: true
}, function(fileEntry) {
alert(fileName);
fileEntry.createWriter(function(writer) {
writer.onwrite = function(e) {
alert("Write data success!");
};
writer.onerror = function(e) {
alert("Write data error!");
};
// Write data to the end of file.
writer.seek(writer.length);
writer.write(newarr);
}, function(e) {
alert('create error!' + e.message);
});
}, function(e) {
alert('getFile error!');
});
}
}, function(e) {
alert('resolve URL error!');
});

你可能感兴趣的:(H5+写文件)