This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class OrientationFixer { | |
/** | |
* @param {File} file | |
* @returns {Promise<int>} | |
*/ | |
async determineOrientation(file) { | |
const data = await this._readFileToArrayBuffer(file); | |
const dataView = new DataView(data); | |
return this._isJpegFile(data, dataView) ? (this._getOrientationValueFromJpegData(dataView) || 1) : 1; | |
}; |