Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <meta name="viewport" content="width=device-width" >
</head>
<body>
  <h2>File System Demo</h2>
  <div>Log file: <a id=output href="" download="log.txt">Save</a></div>
  <div>Log file: <a id=output2 href="">Download</a></div>
  
  <script>
    function errorHandler(e) {
      console.log("Error", e);
    }
    
   function onInitFs(fs) {
      fs.root.getFile('log.txt', {create: true}, function(fileEntry) {
        output.href = fileEntry.toURL();
        output2.href = fileEntry.toURL();
        // Create a FileWriter object for our FileEntry (log.txt).
        fileEntry.createWriter(function(fileWriter) {
          fileWriter.seek(fileWriter.length); // Start write position at EOF.
          // Create a new Blob and write it to log.txt.
          var blob = new Blob(['Hello World'], {type: 'text/plain'});
          fileWriter.write(blob);
      
          
        }, errorHandler);
      }, errorHandler)
   }
  
   window.webkitRequestFileSystem(window.TEMPORARY, 5*1024*1024 /*5MB*/, onInitFs, errorHandler);
  </script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
kinlanpro
0viewers