async initLib()

in source/checksum/lib/algorithm/base.js [97:125]


  async initLib() {
    this.bytesRead = 0;
    this.t0 = new Date();

    const s3 = new AWS.S3({
      apiVersion: '2006-03-01',
      signatureVersion: 'v4',
      customUserAgent: process.env.ENV_CUSTOM_USER_AGENT,
    });

    const {
      ContentLength,
      ETag,
    } = await s3.headObject({
      Bucket: this.bucket,
      Key: this.key,
    }).promise();

    const contentLength = Number.parseInt(ContentLength, 10);
    this.fileSize = this.fileSize || contentLength;
    if (this.fileSize !== contentLength) {
      throw new MismatchFileSizeError();
    }

    this.etag = this.etag || ETag;
    if (this.etag !== ETag) {
      throw new MismatchETagError();
    }
  }