code: function extract(checksumVerify, filename, sdkStream, root, strip, name, decompress) {
    return tmpdir()
      .then(destdir => {
        // Exract tarball to destination.
        var extract = tar.extract(destdir.path, {
          strip: strip,
          ignore: function(name) {
            // Ignore self-directory.
            return path.normalize(name + '/') === path.normalize(destdir.path + '/');
          }
        });
  
        return new Promise((resolve, reject) => {
          var checksum = '';
          sdkStream
            .pipe(sha256stream())
            .on('sha256', function(sha256) {
              checksum = sha256file(sha256, filename);
            })
            .pipe(decompress)
            // tar-stream has a recursion issue when input chunks are too big.
            // by splitting up the chunks, we never get too deeply nested in the
            // stack.
            .pipe(blocks({
              size: 64 * 1024,
              zeroPadding: false
            }))
            .pipe(extract)
            .on('finish', () => {
              // Check sum.
              if (checksum !== checksumVerify) {
                return reject(tags.stripIndent `
                  Please file an issue on https://github.com/tessel/t2-cli with the following:
                  The downloaded file ${name} is invalid (wrong checksum).
                    expected: ${checksumVerify}
                    got:      ${checksum}`);
              }
  
              // Write out CHECKSUM file.
              fs.writeFileSync(path.join(destdir.path, 'CHECKSUM'), checksum);
  
              try {
                // Remove the old SDK directory.
                fs.removeSync(root);
                // Move temporary directory to target destination.
                fs.move(destdir.path, root, error => {
                  if (error) {
                    // Cleanup temp dir.
                    destdir.cleanup();
                    reject(error);
                  } else {
                    resolve();
                  }
                });
              } catch (error) {
                // Cleanup temp dir.
                destdir.cleanup();
                reject(error);
              }
            })
            .on('error', error => {
              destdir.cleanup();
              reject(error);
            });
        });
      });
  }
docs: /* istanbul ignore next