Thứ Sáu, 12 tháng 12, 2014

http://stackoverflow.com/questions/11077303/how-to-create-a-directory-and-file-in-that-directory-using-phonegap-file-api

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}

function gotFS(fileSystem) {
   fileSystem.root.getDirectory("data", {create: true}, gotDir);
}

function gotDir(dirEntry) {
    dirEntry.getFile("lockfile.txt", {create: true, exclusive: true}, gotFile);
}

function gotFile(fileEntry) {
    // Do something with fileEntry here
}

Không có nhận xét nào:

Đăng nhận xét