Skip to content

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.

1 participant