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

Last chunk size too large #462

Closed
depiction opened this issue May 10, 2018 · 1 comment
Closed

Last chunk size too large #462

depiction opened this issue May 10, 2018 · 1 comment

Comments

@depiction
Copy link

depiction commented May 10, 2018

If multiple chunks are created, the last chunk is always larger than the chunk size set in the config.

var r = new Resumable({
    target: function (chunk) {
        console.log(chunk)
        return '/test/'
    },
    query: {},
    maxChunkRetries: 2,
    simultaneousUploads: 1,
    chunkSize: 1 * 1024 * 1024 // 1MB
});

The chunk size is 1MB or 1048576 bytes.

I uploaded a 2.5 MB file, but only two chunks were created. Below are the console logs returned from the target function. The first chunk size matches the chunk size set in the config, but the second chunk size is too large.

I also uploaded a 1096 MB file and all the chunk sizes matched the chunk size set in the config, except the last one, which was too big.

[
  "resumableChunkNumber=1",
  "resumableChunkSize=1048576",
  "resumableCurrentChunkSize=1048576",
  "resumableTotalSize=2459177",
  "resumableType=application%2Fpdf",
  "resumableIdentifier=2459177-March222018-RigorDefectReportpdf",
  "resumableFilename=March%2022%202018%20%20-%20Rigor%20Defect%20Report.pdf",
  "resumableRelativePath=March%2022%202018%20%20-%20Rigor%20Defect%20Report.pdf",
  "resumableTotalChunks=2"
]

[
  "resumableChunkNumber=2",
  "resumableChunkSize=1048576",
  "resumableCurrentChunkSize=1410601",
  "resumableTotalSize=2459177",
  "resumableType=application%2Fpdf",
  "resumableIdentifier=2459177-March222018-RigorDefectReportpdf",
  "resumableFilename=March%2022%202018%20%20-%20Rigor%20Defect%20Report.pdf",
  "resumableRelativePath=March%2022%202018%20%20-%20Rigor%20Defect%20Report.pdf",
  "resumableTotalChunks=2"
]

@depiction depiction changed the title Wrong chunk size Chunk size too large May 10, 2018
@depiction depiction changed the title Chunk size too large Last chunk size too large May 10, 2018
@depiction
Copy link
Author

Closing. Duplicate of #51

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

No branches or pull requests

1 participant