code: function (r) {
              // If DONE (cancelled), then don't do anything
              if (me.readyState === FileWriter.DONE) {
                  return;
              }
  
              // position always increases by bytes written because file would be extended
              me.position += r;
              // The length of the file is now where we are done writing.
  
              me.length = me.position;
  
              // DONE state
              me.readyState = FileWriter.DONE;
  
              // If onwrite callback
              if (typeof me.onwrite === 'function') {
                  me.onwrite(new ProgressEvent('write', { 'target':me }));
              }
  
              // If onwriteend callback
              if (typeof me.onwriteend === 'function') {
                  me.onwriteend(new ProgressEvent('writeend', { 'target':me }));
              }
          }
docs: Success callback