项目作者: demeter-macik

项目描述 :
Node.js + Express + Busboy multipart upload example
高级语言: JavaScript
项目地址: git://github.com/demeter-macik/multipart-upload-example.git
创建时间: 2019-03-12T10:31:01Z
项目社区:https://github.com/demeter-macik/multipart-upload-example

开源协议:

下载


Multipart upload example

Simple multipart uploading zip-file example with uncompressing, calculating hash and size for zip-file itself and all uncompressed files. Example uses Node.js, Express, Busboy.

How it works

Uploading process is separated into simple tasks: unzip, calculate hash, size. All operations are running in parallel streams. That means that application require only 16KiB * task count RAM to upload large zip-files. You can handle many uploads with reasonable RAM size. You can change HIGH_WATER_MARK constant (/src/app.js:20) value to change streams max buffer size.

testing mesh

How to run

First install all required dependencies

  1. npm i

Next run application

  1. npm run start

And run tests

  1. npm run test

To see debug info

  1. export DEBUG=*

Generate docs

  1. npm run jsdoc:build

Response example

  1. { fileName: 'file.zip',
  2. size: 9833,
  3. md5: 'e14d4c5ce9d0cd5567dae645ed0f3c5e',
  4. 'image.jpg':
  5. { size: 1357,
  6. filepath: '/home/user/projects/multipart-upload-example/uploads/bedde47d-8c47-4c6c-b707-f5321c2eede7-image.jpg',
  7. md5: '273bbb631a76f5fbb94439c7b700ab85' },
  8. 'image.png':
  9. { size: 4917,
  10. filepath: '/home/user/projects/multipart-upload-example/uploads/889c7e48-37dd-4593-a6d9-f50676fed8dd-image.png',
  11. md5: 'e797bc84a09ad578c125faa1c3500445' },
  12. 'text.txt':
  13. { size: 11311,
  14. filepath: '/home/user/projects/multipart-upload-example/uploads/629bf40c-31ef-4632-813d-e8074095b58a-text.txt',
  15. md5: 'fa2f2202e281bd064ada88c5e2d5e183' }
  16. }