size.js
function verifySize(correctSize, filepath) {
    return calculateSize(filepath).then(size => {
        if (size !== correctSize) {
            throw new Error(`Incorrect file size: expected ${correctSize}, got ${size}`);
        }
        return true;
    });
}
function verifySize(correctSize, filepath) {
    return calculateSize(filepath).then(size => {
        if (size !== correctSize) {
            throw new Error(`Incorrect file size: expected ${correctSize}, got ${size}`);
        }
        return true;
    });
}
function verifySize ( correctSize , filepath ) { return calculateSize ( filepath ) . then ( size => { if ( size !== correctSize ) { throw new Error ( ` ${ correctSize } ${ size } ` ) ; } return true ; } ) ; }
Calculates file size and compares
it to the provided one.

Returns a promise which rejects if the size is
incorrect, otherwise resolves to true.

@param {number} correctSize expected file size
@param {string} filepath file path
@returns {Promise<boolean>}
Calculates file size and compares it to the provided one .