Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: file/range checksum support #600

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

kukhariev
Copy link
Owner

Added option checksum to enable sha1/md5 rolling hashes.

import { uploadx } from '@uploadx/core';
import * as express from 'express';

const app = express();
app.all(
  '/files',
  uploadx({
    directory: 'upload',
    checksum: 'sha1',
    onComplete: file => {
      console.log('File upload complete: %s, sha1: %s', file.originalName, file.sha1);
      return file;
    }
  })
);

app.listen(3002);

The checksum of the uploaded data is updated every chunk and sent to the client via the x-range-sha1 or x-range-md5 headers:

HTTP/1.1 308 Resume Incomplete

X-Range-SHA1: a8b78179bd6bd0132acc9c9bf14739f3f42d2839
Range: bytes=0-3145727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant