@acaprojects/a2-uploads 中文文档教程

发布于 7年前 浏览 21 项目主页 更新于 3年前

Introduction

这个项目是一个 Angular2 库,用于处理由 Condominios 项目管理的安全的直接云上传。 在 CoTag Media,我们使用它来处理我们所有的文件摄取,因为它:

实际上这个项目采用 blob 或文件对象在浏览器中,

  • Manages an upload queue with pause, resume and progress for each upload
  • Supports configuring individual upload parallelism and the number of simultaneous uploads
  • All files are hashed in webworkers before upload for data integrity
  • Communicates with Condominios to obtain signed requests for the uploads

Usage

  1. Optionally bootstrap MD5_WORKER_BASE - this allows you to customise the path of the MD5 worker
  2. Bootstrap the MD5Workers - these perform the hashing in webworkers and should only be instansitated once
  3. In the components you wish to perform uploads, inject your Http service and the MD5Workers
  4. Import UploadManager and the storage providers you wish to use Amazon, Google, Azure, OpenStack
  5. Add the providers to the upload manager: UploadManager.addProvider(Amazon);

您现在可以使用管理器

this.manager = new UploadManager(http, '/uploads', workers);
this.manager.autoStart = true;

// ...

// Add files to the upload manager
// Files is an array of Blobs or Files -> https://developer.mozilla.org/en/docs/Web/API/File
this.manager.upload(files);

Building from src

该项目是用 typescript 编写并转换为 ES5 的。

  1. Install TypeScript: npm install -g typescript (if you haven't already)
  2. Configure compile options in tsconfig.json
  3. Perform build using: tsc or build script below

您可以在此处找到更多信息:https://github.com/Microsoft/TypeScript/wiki/tsconfig.json

Scripts

  1. Build Script: npm run build
  2. Test Script: npm run test

Publishing

  1. Sign up to https://www.npmjs.com/
  2. Configure package.json https://docs.npmjs.com/files/package.json
  3. run npm publish https://docs.npmjs.com/cli/publish

License

MIT

Introduction

This project is an Angular2 library for handling secure direct to cloud uploads that are managed by the Condominios project. At CoTag Media we use it to handle all of our file ingestion as it:

Effectively this project takes blob or file objects in the browser and

  • Manages an upload queue with pause, resume and progress for each upload
  • Supports configuring individual upload parallelism and the number of simultaneous uploads
  • All files are hashed in webworkers before upload for data integrity
  • Communicates with Condominios to obtain signed requests for the uploads

Usage

  1. Optionally bootstrap MD5_WORKER_BASE - this allows you to customise the path of the MD5 worker
  2. Bootstrap the MD5Workers - these perform the hashing in webworkers and should only be instansitated once
  3. In the components you wish to perform uploads, inject your Http service and the MD5Workers
  4. Import UploadManager and the storage providers you wish to use Amazon, Google, Azure, OpenStack
  5. Add the providers to the upload manager: UploadManager.addProvider(Amazon);

You can now use the manager

this.manager = new UploadManager(http, '/uploads', workers);
this.manager.autoStart = true;

// ...

// Add files to the upload manager
// Files is an array of Blobs or Files -> https://developer.mozilla.org/en/docs/Web/API/File
this.manager.upload(files);

Building from src

The project is written in typescript and transpiled into ES5.

  1. Install TypeScript: npm install -g typescript (if you haven't already)
  2. Configure compile options in tsconfig.json
  3. Perform build using: tsc or build script below

You can find more information here: https://github.com/Microsoft/TypeScript/wiki/tsconfig.json

Scripts

  1. Build Script: npm run build
  2. Test Script: npm run test

Publishing

  1. Sign up to https://www.npmjs.com/
  2. Configure package.json https://docs.npmjs.com/files/package.json
  3. run npm publish https://docs.npmjs.com/cli/publish

License

MIT

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文