diff --git a/README.md b/README.md index 48e01818..f73c82a0 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ Available configuration options are: * `target` The target URL for the multipart POST request (Default: `/`) * `chunkSize` The size in bytes of each uploaded chunk of data (Default: `1*1024*1024`) +* `forceChunkSize` Force all chunks to be less or equal than chunkSize. Otherwise, the last chunk will be greater or equal chunkSize. (Default: `false`) * `simultaneousUploads` Number of simultaneous uploads (Default: `3`) * `fileParameterName` The name of the multipart POST parameter to use for the file chunk (Default: `file`) * `query` Extra parameters to include in the multipart POST with data. This can be an object or a function. If a function, it will be passed a ResumableFile and a ResumableChunk object (Default: `{}`) diff --git a/resumable.js b/resumable.js index 35912daf..d3078a68 100644 --- a/resumable.js +++ b/resumable.js @@ -32,6 +32,7 @@ var Resumable = function(opts){ $.files = []; $.defaults = { chunkSize:1*1024*1024, + forceChunkSize:false, simultaneousUploads:3, fileParameterName:'file', throttleProgressCallbacks:0.5, @@ -218,7 +219,8 @@ var Resumable = function(opts){ // Rebuild stack of chunks from file $.chunks = []; $._prevProgress = 0; - for (var offset=0; offset