code: function onPart (part) {
    var form = this;
  
    if (undefined === part.filename) return form.handlePart(part);
  
    ++form._flushing;
  
    var file = new File(part.filename, form.__filename(part.filename), part.mime);
  
    form.emit('fileBegin', part.name, file);
  
    var options = { mode: 'w', content_type: file.type, filename: file.path };
    if (form.chunk_size) options.chunk_size = form.chunk_size;
    if (form.root) options.root = form.root;
    options.metadata = file.metadata ? file.metadata
                     : form.metadata ? form.metadata
                     : undefined
    var ws = form.__gridstream.createWriteStream(options);
  
    ws.on('progress', onprogress);
    ws.on('drain', resume);
    ws.once('error', done);
    part.on('data', onData);
    part.once('end', onEnd);
  
    function onprogress (size) {
      file.lastModified = new Date;
      file.size = size;
      file.emit('progress', size);
    }
  
    function resume () {
      form.resume();
    };
  
    function onData (data) {
      form.pause();
      ws.write(data);
    };
  
    function onEnd () {
      part.removeListener('data', onData);
      part.removeListener('end', onEnd);
      ws.once('close', function (_) {
        done();
      });
      ws.end();
    };
  
    function done (err) {
      if (done.err) return;
      if (err) return form.emit('error', done.err = err);
  
      ws.removeListener('progress', onprogress);
      ws.removeListener('drain', resume);
      ws.removeListener('error', done);
  
      file.id || (file.id = ws._store.fileId);
      file.root = ws._store.root;
      file.size = ws._store.position;
      file.emit('end');
  
      --form._flushing;
  
      form.emit('file', part.name, file);
      form._maybeEnd();
    }
  }
docs: onPart
  
  @param {formidable Part} part
  @api private
  @ignore