s3-readstream
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -17,4 +17,25 @@ /// <reference types="node" /> | ||
constructor(options: S3ReadStreamOptions, nodeReadableStreamOptions?: ReadableOptions); | ||
/** | ||
* Adjust size of range to grab from S3 | ||
* | ||
* @param {number} bytes - Number of bytes to set for range | ||
*/ | ||
adjustByteRange(bytes: number): void; | ||
/** | ||
* Moves cursor bytes length back in file | ||
* | ||
* If current cursor position - number of bytes to move back | ||
* is <= 0, set cursor at begining of file | ||
* @param {number} bytes - Number of bytes to subtract from cursor (defaults to range) | ||
*/ | ||
moveCursorBack(bytes?: number): void; | ||
/** | ||
* Moves cursor bytes length forward in file | ||
* | ||
* If current cursor position + number of bytes to move forward | ||
* is > the length of the file, set cursor at end of file | ||
* @param {number} bytes - Number of bytes to add to cursor (defaults to range) | ||
*/ | ||
moveCursorForward(bytes?: number): void; | ||
_read(): void; | ||
} |
@@ -28,8 +28,45 @@ "use strict"; | ||
_this._s3StreamParams = options.parameters; | ||
_this._s3DataRange = options.byteRange || 1024 * 1024; | ||
_this._s3DataRange = options.byteRange || 64 * 1024; | ||
return _this; | ||
} | ||
/** | ||
* Adjust size of range to grab from S3 | ||
* | ||
* @param {number} bytes - Number of bytes to set for range | ||
*/ | ||
S3ReadStream.prototype.adjustByteRange = function (bytes) { | ||
this._s3DataRange = bytes; | ||
}; | ||
/** | ||
* Moves cursor bytes length back in file | ||
* | ||
* If current cursor position - number of bytes to move back | ||
* is <= 0, set cursor at begining of file | ||
* @param {number} bytes - Number of bytes to subtract from cursor (defaults to range) | ||
*/ | ||
S3ReadStream.prototype.moveCursorBack = function (bytes) { | ||
if (bytes === void 0) { bytes = this._s3DataRange; } | ||
if (this._currentCursorPosition - bytes > 0) { | ||
this._currentCursorPosition -= bytes; | ||
} | ||
else { | ||
this._currentCursorPosition = 0; | ||
} | ||
}; | ||
/** | ||
* Moves cursor bytes length forward in file | ||
* | ||
* If current cursor position + number of bytes to move forward | ||
* is > the length of the file, set cursor at end of file | ||
* @param {number} bytes - Number of bytes to add to cursor (defaults to range) | ||
*/ | ||
S3ReadStream.prototype.moveCursorForward = function (bytes) { | ||
if (bytes === void 0) { bytes = this._s3DataRange; } | ||
if (this._currentCursorPosition + bytes <= this._maxContentLength) { | ||
this._currentCursorPosition += bytes; | ||
} | ||
else { | ||
this._currentCursorPosition += this._maxContentLength + 1; | ||
} | ||
}; | ||
S3ReadStream.prototype._read = function () { | ||
@@ -36,0 +73,0 @@ var _this = this; |
{ | ||
"name": "s3-readstream", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Drop in AWS S3 replacement read stream", | ||
@@ -5,0 +5,0 @@ "main": "dist/S3Readstream.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14921
226