Git Product home page Git Product logo

batch_upload_file's Introduction

batch_upload_pic

介绍

脱离redis, 基于内存, 批量上传文件到远程服务器,按照设置大小设置每次请求的包的大小和并发数量限制

版本历史

8ab6b2e: 这是版本V 0.2.0 该本版支持调用者实现上传逻辑和接收回调

API

初始化任务队列

Upload.init({
  base_url: 'http://127.0.0.1:3008/',   // 远程目标服务器地址
  check_path: 'check_file',             // 文件校验接口
  upload_path: 'file',                  // 上传接口
});

添加任务

var file_arr = [ 'D:/files/a.test', 'D:/files/b.test' ];
Upload.createJob(file_arr);

执行任务

Upload.process(upload, callback); //about upload and callback detail please Reference ./test demo

查询当前任务状态

const status = await Upload.status();
console.log(status);

TIPS

支持上传的文件可以在./lib/file_ext.json 中添加或修改

[
  {
    "ext": ".png",
    "contentType": "image/png"
  },
  {
    "ext": ".jpeg",
    "contentType": "image/jpeg"
  },
  {
    "ext": "jpg",
    "contentType": "image/jpeg"
  },
  {
    "ext": ".txt",
    "contentType": "text/plain"
  }
]

第三方库:bagpipe 需要修改源码./lib/bagpipe.js 148行为:method.apply(this, args);

batch_upload_file's People

Contributors

xiaoyaos avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.