掉过一个文件上传，直接标记指定文件为已上传状态。
@grammar skipFile( file ) => undefined
@method skipFile
@for  Uploader
331150
function( file, status ) {
                file = this.request( 'get-file', file );
    
                file.setStatus( status || Status.COMPLETE );
                file.skipped = true;
    
                // 如果正在上传。
                file.blocks && $.each( file.blocks, function( _, v ) {
                    var _tr = v.transport;
    
                    if ( _tr ) {
                        _tr.abort();
                        _tr.destroy();
                        delete v.transport;
                    }
                });
    
                this.owner.trigger( 'uploadSkip', file );
            }
1366334
def uploadFile(uploadfunc, fileindex, existing, uf, skip_broken=False):
    

    if uf["location"].startswith("toilfs:") or uf["location"].startswith("_:"):
        return
    if uf["location"] in fileindex:
        uf["location"] = fileindex[uf["location"]]
        return
    if not uf["location"] and uf["path"]:
        uf["location"] = schema_salad.ref_resolver.file_uri(uf["path"])
    if uf["location"].startswith("file://") and not os.path.isfile(uf["location"][7:]):
        if skip_broken:
            return
        else:
            raise cwltool.errors.WorkflowException(
                "File is missing: %s" % uf["location"])
    uf["location"] = write_file(
        uploadfunc, fileindex, existing, uf["location"])
1087809
function (e, data) {
                if (e.isDefaultPrevented()) {
                    return false;
                }
                var $this = $(this),
                    that = $this.data('blueimp-fileupload') ||
                        $this.data('fileupload'),
                    options = that.options;
                data.context = that._renderUpload(data.files)
                    .data('data', data)
                    .addClass('processing');
                options.filesContainer[
                    options.prependFiles ? 'prepend' : 'append'
                ](data.context);
                that._forceReflow(data.context);
                that._transition(data.context);
                data.process(function () {
                    return $this.fileupload('process', data);
                }).always(function () {
                    data.context.each(function (index) {
                        $(this).find('.size').text(
                            that._formatFileSize(data.files[index].size)
                        );
                    }).removeClass('processing');
                    that._renderPreviews(data);
                }).done(function () {
                    data.context.find('.start').prop('disabled', false);
                    if ((that._trigger('added', e, data) !== false) &&
                            (options.autoUpload || data.autoUpload) &&
                            data.autoUpload !== false) {
                        data.submit();
                    }
                }).fail(function () {
                    if (data.files.error) {
                        data.context.each(function (index) {
                            var error = data.files[index].error;
                            if (error) {
                                $(this).find('.error').text(error);
                            }
                        });
                    }
                });
            }
179143
function addJSIndent(file, t) {
    var addIndent = '  ';
    var filepath = file.path.replace(/\\/g, '/');
    if (
      filepath.endsWith('/global/js/wrap_start.js') ||
      filepath.endsWith('/global/js/wrap_end.js')
    ) {
      addIndent = '';
    }

    if (addIndent !== '') {
      var fileLines = fs.readFileSync(file.path).toString().split('\n');
      var newFileContents = '';
      $.each(fileLines, function (i, fileLine) {
        newFileContents +=
          (fileLine ? addIndent : '') +
          fileLine +
          (i === fileLines.length ? '' : '\n');
      });

      file.contents = new Buffer(newFileContents);
    }
  }
1362229
function _filesToStream (files, separator, callback) {

			if ("undefined" === typeof files) {
				throw new ReferenceError("missing \"files\" argument");
			}
				else if ("object" !== typeof files || !(files instanceof Array)) {
					throw new TypeError("\"files\" argument is not an Array");
				}
			else if ("undefined" === typeof callback && "undefined" === typeof separator) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof separator) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				const writeStream = new Transform();

				writeStream._transform = (chunk, enc, cb) => {
					writeStream.push(chunk);
					cb();
				};

				writeStream.once("error", () => {
					writeStream.end();
				});

				const _callback = "undefined" === typeof callback ? separator : callback;
				_callback(null, writeStream);

				_readContent(files, writeStream, "string" === typeof separator ? separator : " ").then(() => {
					writeStream.end();
					writeStream.emit("close");
				}).catch((err) => {
					writeStream.emit("error", err);
				});

			}

		}
69999
function(selector, filename, done) {
    this.debug('Upload ' + filename + ' to ' + selector);
    getPage(function(page) {
      page.uploadFile(selector, filename, done);
    });
      done();
  }
1053807
function (skipWrite) {
        var self = this, settings = self.settings, targetElm = self.getElement(), doc = self.getDoc(), body, contentCssText;

        // Restore visibility on target element
        if (!settings.inline) {
          self.getElement().style.visibility = self.orgVisibility;
        }

        // Setup iframe body
        if (!skipWrite && !settings.content_editable) {
          doc.open();
          doc.write(self.iframeHTML);
          doc.close();
        }

        if (settings.content_editable) {
          self.on('remove', function () {
            var bodyEl = this.getBody();

            DOM.removeClass(bodyEl, 'mce-content-body');
            DOM.removeClass(bodyEl, 'mce-edit-focus');
            DOM.setAttrib(bodyEl, 'contentEditable', null);
          });

          DOM.addClass(targetElm, 'mce-content-body');
          self.contentDocument = doc = settings.content_document || document;
          self.contentWindow = settings.content_window || window;
          self.bodyElement = targetElm;

          // Prevent leak in IE
          settings.content_document = settings.content_window = null;

          // TODO: Fix this
          settings.root_name = targetElm.nodeName.toLowerCase();
        }

        // It will not steal focus while setting contentEditable
        body = self.getBody();
        body.disabled = true;
        self.readonly = settings.readonly;

        if (!self.readonly) {
          if (self.inline && DOM.getStyle(body, 'position', true) == 'static') {
            body.style.position = 'relative';
          }

          body.contentEditable = self.getParam('content_editable_state', true);
        }

        body.disabled = false;

        self.editorUpload = new EditorUpload(self);

        /**
         * Schema instance, enables you to validate elements and its children.
         *
         * @property schema
         * @type tinymce.html.Schema
         */
        self.schema = new Schema(settings);

        /**
         * DOM instance for the editor.
         *
         * @property dom
         * @type tinymce.dom.DOMUtils
         * @example
         * // Adds a class to all paragraphs within the editor
         * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
         */
        self.dom = new DOMUtils(doc, {
          keep_values: true,
          url_converter: self.convertURL,
          url_converter_scope: self,
          hex_colors: settings.force_hex_style_colors,
          class_filter: settings.class_filter,
          update_styles: true,
          root_element: self.inline ? self.getBody() : null,
          collect: settings.content_editable,
          schema: self.schema,
          onSetAttrib: function (e) {
            self.fire('SetAttrib', e);
          }
        });

        /**
         * HTML parser will be used when contents is inserted into the editor.
         *
         * @property parser
         * @type tinymce.html.DomParser
         */
        self.parser = new DomParser(settings, self.schema);

        // Convert src and href into data-mce-src, data-mce-href and data-mce-style
        self.parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {
          var i = nodes.length, node, dom = self.dom, value, internalName;

          while (i--) {
            node = nodes[i];
            value = node.attr(name);
            internalName = 'data-mce-' + name;

            // Add internal attribute if we need to we don't on a refresh of the document
            if (!node.attributes.map[internalName]) {
              // Don't duplicate these since they won't get modified by any browser
              if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {
                continue;
              }

              if (name === "style") {
                value = dom.serializeStyle(dom.parseStyle(value), node.name);

                if (!value.length) {
                  value = null;
                }

                node.attr(internalName, value);
                node.attr(name, value);
              } else if (name === "tabindex") {
                node.attr(internalName, value);
                node.attr(name, null);
              } else {
                node.attr(internalName, self.convertURL(value, name, node.name));
              }
            }
          }
        });

        // Keep scripts from executing
        self.parser.addNodeFilter('script', function (nodes) {
          var i = nodes.length, node, type;

          while (i--) {
            node = nodes[i];
            type = node.attr('type') || 'no/type';
            if (type.indexOf('mce-') !== 0) {
              node.attr('type', 'mce-' + type);
            }
          }
        });

        self.parser.addNodeFilter('#cdata', function (nodes) {
          var i = nodes.length, node;

          while (i--) {
            node = nodes[i];
            node.type = 8;
            node.name = '#comment';
            node.value = '[CDATA[' + node.value + ']]';
          }
        });

        self.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) {
          var i = nodes.length, node, nonEmptyElements = self.schema.getNonEmptyElements();

          while (i--) {
            node = nodes[i];

            if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) {
              node.append(new Node('br', 1)).shortEnded = true;
            }
          }
        });

        /**
         * DOM serializer for the editor. Will be used when contents is extracted from the editor.
         *
         * @property serializer
         * @type tinymce.dom.Serializer
         * @example
         * // Serializes the first paragraph in the editor into a string
         * tinymce.activeEditor.serializer.serialize(tinymce.activeEditor.dom.select('p')[0]);
         */
        self.serializer = new DomSerializer(settings, self);

        /**
         * Selection instance for the editor.
         *
         * @property selection
         * @type tinymce.dom.Selection
         * @example
         * // Sets some contents to the current selection in the editor
         * tinymce.activeEditor.selection.setContent('Some contents');
         *
         * // Gets the current selection
         * alert(tinymce.activeEditor.selection.getContent());
         *
         * // Selects the first paragraph found
         * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]);
         */
        self.selection = new Selection(self.dom, self.getWin(), self.serializer, self);

        /**
         * Formatter instance.
         *
         * @property formatter
         * @type tinymce.Formatter
         */
        self.formatter = new Formatter(self);

        /**
         * Undo manager instance, responsible for handling undo levels.
         *
         * @property undoManager
         * @type tinymce.UndoManager
         * @example
         * // Undoes the last modification to the editor
         * tinymce.activeEditor.undoManager.undo();
         */
        self.undoManager = new UndoManager(self);

        self.forceBlocks = new ForceBlocks(self);
        self.enterKey = new EnterKey(self);
        self._nodeChangeDispatcher = new NodeChange(self);
        self._selectionOverrides = new SelectionOverrides(self);

        self.fire('PreInit');

        if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {
          doc.body.spellcheck = false; // Gecko
          DOM.setAttrib(body, "spellcheck", "false");
        }

        self.quirks = new Quirks(self);
        self.fire('PostRender');

        if (settings.directionality) {
          body.dir = settings.directionality;
        }

        if (settings.nowrap) {
          body.style.whiteSpace = "nowrap";
        }

        if (settings.protect) {
          self.on('BeforeSetContent', function (e) {
            each(settings.protect, function (pattern) {
              e.content = e.content.replace(pattern, function (str) {
                return '<!--mce:protected ' + escape(str) + '-->';
              });
            });
          });
        }

        self.on('SetContent', function () {
          self.addVisual(self.getBody());
        });

        // Remove empty contents
        if (settings.padd_empty_editor) {
          self.on('PostProcess', function (e) {
            e.content = e.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|<br \/>|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
          });
        }

        self.load({ initial: true, format: 'html' });
        self.startContent = self.getContent({ format: 'raw' });

        /**
         * Is set to true after the editor instance has been initialized
         *
         * @property initialized
         * @type Boolean
         * @example
         * function isEditorInitialized(editor) {
         *     return editor && editor.initialized;
         * }
         */
        self.initialized = true;
        self.bindPendingEventDelegates();

        self.fire('init');
        self.focus(true);
        self.nodeChanged({ initial: true });
        self.execCallback('init_instance_callback', self);

        self.on('compositionstart compositionend', function (e) {
          self.composing = e.type === 'compositionstart';
        });

        // Add editor specific CSS styles
        if (self.contentStyles.length > 0) {
          contentCssText = '';

          each(self.contentStyles, function (style) {
            contentCssText += style + "\r\n";
          });

          self.dom.addStyle(contentCssText);
        }

        // Load specified content CSS last
        each(self.contentCSS, function (cssUrl) {
          if (!self.loadedCSS[cssUrl]) {
            self.dom.loadCSS(cssUrl);
            self.loadedCSS[cssUrl] = true;
          }
        });

        // Handle auto focus
        if (settings.auto_focus) {
          Delay.setEditorTimeout(self, function () {
            var editor;

            if (settings.auto_focus === true) {
              editor = self;
            } else {
              editor = self.editorManager.get(settings.auto_focus);
            }

            if (!editor.destroyed) {
              editor.focus();
            }
          }, 100);
        }

        // Clean up references for IE
        targetElm = doc = body = null;
      }
266765
function sliceUploadFile(params, callback) {
    var self = this;
    var ep = new EventProxy();
    var TaskId = params.TaskId;
    var Bucket = params.Bucket;
    var Region = params.Region;
    var Key = params.Key;
    var FilePath = params.FilePath;
    var ChunkSize = params.ChunkSize || params.SliceSize || this.options.ChunkSize;
    var AsyncLimit = params.AsyncLimit;
    var StorageClass = params.StorageClass || 'Standard';
    var ServerSideEncryption = params.ServerSideEncryption;
    var FileSize;

    var onProgress;
    var onHashProgress = params.onHashProgress;

    // 上传过程中出现错误，返回错误
    ep.on('error', function (err) {
        if (!self._isRunningTask(TaskId)) return;
        return callback(err);
    });

    // 上传分块完成，开始 uploadSliceComplete 操作
    ep.on('upload_complete', function (UploadCompleteData) {
        callback(null, UploadCompleteData);
    });

    // 上传分块完成，开始 uploadSliceComplete 操作
    ep.on('upload_slice_complete', function (UploadData) {
        uploadSliceComplete.call(self, {
            Bucket: Bucket,
            Region: Region,
            Key: Key,
            UploadId: UploadData.UploadId,
            SliceList: UploadData.SliceList,
        }, function (err, data) {
            if (!self._isRunningTask(TaskId)) return;
            delete uploadIdUsing[UploadData.UploadId];
            if (err) {
                onProgress(null, true);
                return ep.emit('error', err);
            }
            onProgress({loaded: FileSize, total: FileSize}, true);
            removeUploadId.call(self, UploadData.UploadId);
            ep.emit('upload_complete', data);
        });
    });

    // 获取 UploadId 完成，开始上传每个分片
    ep.on('get_upload_data_finish', function (UploadData) {

        // 处理 UploadId 缓存
        var uuid = util.getFileUUID(params.FileStat, params.ChunkSize);
        uuid && setUploadId.call(self, uuid, UploadData.UploadId); // 缓存 UploadId
        uploadIdUsing[UploadData.UploadId] = true; // 标记 UploadId 为正在使用
        TaskId && self.on('inner-kill-task', function (data) {
            if (data.TaskId === TaskId && data.toState === 'canceled') {
                delete uploadIdUsing[UploadData.UploadId]; // 去除 UploadId 正在使用的标记
            }
        });

        // 获取 UploadId
        uploadSliceList.call(self, {
            TaskId: TaskId,
            Bucket: Bucket,
            Region: Region,
            Key: Key,
            FilePath: FilePath,
            FileSize: FileSize,
            SliceSize: ChunkSize,
            AsyncLimit: AsyncLimit,
            ServerSideEncryption: ServerSideEncryption,
            UploadData: UploadData,
            onProgress: onProgress
        }, function (err, data) {
            if (!self._isRunningTask(TaskId)) return;
            if (err) {
                onProgress(null, true);
                return ep.emit('error', err);
            }
            ep.emit('upload_slice_complete', data);
        });
    });

    // 开始获取文件 UploadId，里面会视情况计算 ETag，并比对，保证文件一致性，也优化上传
    ep.on('get_file_size_finish', function () {

        onProgress = util.throttleOnProgress.call(self, FileSize, params.onProgress);

        if (params.UploadData.UploadId) {
            ep.emit('get_upload_data_finish', params.UploadData);
        } else {
            var _params = util.extend({
                TaskId: TaskId,
                Bucket: Bucket,
                Region: Region,
                Key: Key,
                Headers: params.Headers,
                StorageClass: StorageClass,
                FilePath: FilePath,
                FileSize: FileSize,
                SliceSize: ChunkSize,
                onHashProgress: onHashProgress,
            }, params);
            getUploadIdAndPartList.call(self, _params, function (err, UploadData) {
                if (!self._isRunningTask(TaskId)) return;
                if (err) return ep.emit('error', err);
                params.UploadData.UploadId = UploadData.UploadId;
                params.UploadData.PartList = UploadData.PartList;
                ep.emit('get_upload_data_finish', params.UploadData);
            });
        }
    });

    // 获取上传文件大小
    FileSize = params.ContentLength;
    delete params.ContentLength;
    !params.Headers && (params.Headers = {});
    util.each(params.Headers, function (item, key) {
        if (key.toLowerCase() === 'content-length') {
            delete params.Headers[key];
        }
    });

    // 控制分片大小
    (function () {
        var SIZE = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 1024 * 2, 1024 * 4, 1024 * 5];
        var AutoChunkSize = 1024 * 1024;
        for (var i = 0; i < SIZE.length; i++) {
            AutoChunkSize = SIZE[i] * 1024 * 1024;
            if (FileSize / AutoChunkSize <= self.options.MaxPartNumber) break;
        }
        params.ChunkSize = params.SliceSize = ChunkSize = Math.max(ChunkSize, AutoChunkSize);
    })();

    // 开始上传
    if (FileSize === 0) {
        params.Body = '';
        params.ContentLength = 0;
        params.SkipTask = true;
        self.putObject(params, function (err, data) {
            if (err) {
                return callback(err);
            }
            callback(null, data);
        });
    } else {
        ep.emit('get_file_size_finish');
    }

}
804732
function uploadFileList(files){

		// FileList
		if(!("FileList" in window) || (files instanceof File) || (files instanceof Blob)){
			// Make an Array
			files = [files];
		}


		var max = 20, len = files.length;
		if(len>max){
			var bool = confirm("You man only upload "+max+" files at a time");
			if(!bool){
				return;
			}
			len = max;
		}

		// Loop through the array and place the items on the page
		for(var i=0;i<len;i++){
			createRef(files[i]);
		}
	}
465708
function tryFile(file) {
	return new Promise((resolve, reject) => {
		fs.stat(file, (err, stat) => {
			if (err) {
				return reject(err);
			}

			if (!stat.isFile()) {
				return reject(new Error(`${file} is not a file`));
			}

			resolve(file);
		});
	});
}
170091
function (e) {
                var that = $(this).data('blueimp-fileupload') ||
                        $(this).data('fileupload'),
                    deferred = that._addFinishedDeferreds();
                $.when.apply($, that._getFinishedDeferreds())
                    .done(function () {
                        that._trigger('stopped', e);
                    });
                that._transition($(this).find('.fileupload-progress')).done(
                    function () {
                        $(this).find('.progress')
                            .attr('aria-valuenow', '0')
                            .find('.bar').css('width', '0%');
                        $(this).find('.progress-extended').html('&nbsp;');
                        deferred.resolve();
                    }
                );
            }
444527
function pickFile(rootFolder, fileName) {
    var result = path.join(rootFolder, fileName);
    if (fs.existsSync(result)) {
        return result;
    }

    return undefined;
}
1057063
function(file) {

      var defer = new $.Deferred(),
        size = file.size,
        $media = file.type === 'VIDEO' ? $('<video>') : $('<audio>'),
        onMediaLoaded = function() {
          log('File Loaded:' + file.source);

          _bytesLoaded += size;

          onElementLoaded(file, $media[0]);

          _files[_currentSegment].splice(0, 1);

          $media.off();
          $media = null;

          updatePercentage();
          defer.resolve();
        };

      // if it is a mobile or an iPad we avoid the media preloading
      if (!_isMobile && !_isTablet) {

        $media.on('loadstart', function() {
          if (this.networkState === 3) {
            onMediaError(file, this);
            onMediaLoaded();
          }
        });

        $media.on('error stalled', function() {
          onMediaError(file, this);
          onMediaLoaded();
        });

        // on Media Progress
        $media.on('loadedmetadata', function() {
          $media.on('progress', function() {
            var bytesTmpLoaded = 0;
            log('loading in progress file:' + file.source);
            if (this.buffered.length > 0) {
              bytesTmpLoaded = (size / this.duration) * this.buffered.end(0);
              size -= bytesTmpLoaded;
              _bytesLoaded += bytesTmpLoaded;
              updatePercentage();
              // Check if the video has been buffered enough to be considered preloaded
              if (1 / size * bytesTmpLoaded > mediaBufferSizeToPreload && !forceMediaPreload)
                onMediaLoaded();
            }
          });
        });

        $media.attr({
          preload: 'auto',
          src: file.source,
          controls: 'controls'
        });

        // let the browser decide when the media file has been buffered enough
        // to be played
        if (forceMediaPreload)
          $media.on('canplaythrough', onMediaLoaded);

      } else {
        //  that means that media is loaded by default
        onMediaLoaded();
      }


      return defer.promise();
    }
579307
function (file) {
    this.src = file.src || {};
    if (this.path) {
      this.src.path = this.path;
    }
    if (Buffer.isBuffer(this.contents)) {
      this.content = this.contents.toString();
    }
    if (this.content) {
      this.options.orig = this.content;
    }

    // ensure that `file` has `path` and `content` properties
    this.validate(file);

    this.options.orig = file.content;
    this.options.plural = this.collection.options.plural;
    this.options.handled = this.options.handled = [];

    this.src = file.src || {};
    this.src.path = this.src.path || this.path;

    // add non-emumerable properties
    this.defineOption('route', this.options.route);
    this.define('_callbacks', this._callbacks);
    file.__proto__ = this;
    file.path = this.path;

    // handle `onLoad` middleware routes
    this.app.handle('onLoad', file);
  }
766165
function filterFiles( files ){
    var filtered = [],
        file,
        i;
    for( i = 0; i < files.length; i++ ){
        file = files[ i ];
        if( file.height &&
            file.width &&
            file.url ){
            //This is sufficient to serve as a level
            filtered.push({
                url: file.url,
                width: Number( file.width ),
                height: Number( file.height )
            });
        }
        else {
            $.console.error( 'Unsupported image format: %s', file.url ? file.url : '<no URL>' );
        }
    }

    return filtered.sort(function(a, b) {
        return a.height - b.height;
    });

}
1104632
function dropFile() {
        // Check for File API support
        // if (typeof window.File === 'undefined' ||
        //     typeof window.FileReader === 'undefined') {
        //   alert('The File APIs are not fully supported in this browser.');
        // }

        $("#preview").bind('dragover', function () {
            $("#paper").addClass('hover');
            return false;
        }).bind("dragend", function () {
            $("#paper").removeClass('hover');
            return false;
        }).bind("drop", function (e) {
            $("#paper").removeClass('hover');
            e.stopPropagation();
            e.preventDefault();

            renderImportedFile(e.originalEvent.dataTransfer.files[0]);
            return false;
        });
    }
827031
function uploadToUpyun(path, file, __newFile, done) {
  var options = this.options;
  var upyun = getInstance(options);
  upyun.uploadFile(path, file, __newFile.headers['content-type'], true, function (err, data) {
    if (err) {
      return done(err);
    }
    if (!data) {
      return done(new Error('Upload failed!'));
    }
    if (data && data.statusCode != 200) {
      return done(new Error(data.error['message']));
    }
    __newFile.fd = options.domain + path;
    return done();
  });
}