new S3Queue(threshold)
Buffers multi-part uploads to S3. Used by S3Stream.
Inherits from events.EventEmitter.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
threshold |
Number |
<optional> |
Minimum size chunks to send to S3, must be at least 5 mb. |
- Source:
Methods
-
drain()
-
Drain the data currently in the queue. Emits a 'drain' event with the data as a Buffer.
- Source:
-
full() → {Boolean}
-
Determine whether the queue is full, based on its threshold.
- Source:
Returns:
True if the queue is full.- Type
- Boolean
-
push(chunk)
-
Add a chunk to the queue to be uploaded. Triggers Queue.drain() when the queue is full after the chunk is added. Emits a 'push' event.
Parameters:
Name Type Description chunk
Buffer Data to add to the queue. - Source:
-
reset()
-
Reset the queue's internal chunk storage. Emits a 'reset' event.
- Source:
-
threshold() → {Number}
-
Get the queue's threshold and enforce a minimum of 5 mb. AWS' minimum size for S3 partial uploads is 5mb, except for the last part, which can be whatever size is remaining.
- Source:
Returns:
Threshold in bytes.- Type
- Number