How to create text file in given directory in iphone and android <p>can you please tell me hoe to create text file in given given directory .I need write on that text file .and read the text from that text file. I am able to create folder using this code .But i need to add text file inside the folder(newDir).</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Local File System Example&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; // Wait for Cordova to load document.addEventListener("deviceready", onDeviceReady, false); // Cordova is ready function onDeviceReady() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onFileSystemFail); } function onFileSystemSuccess(fileSystem) { console.log(fileSystem.name); var directoryEntry = fileSystem.root; directoryEntry.getDirectory("newDir", {create: true, exclusive: false}, onDirectorySuccess, onDirectoryFail) } function onDirectorySuccess(parent) { console.log(parent); } function onDirectoryFail(error) { alert("Unable to create new directory: " + error.code); } function onFileSystemFail(evt) { console.log(evt.target.error.code); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Example&lt;/h1&gt; &lt;p&gt;Local File System&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>