code: function tmpdir() {
    return new Promise((resolve) => {
      var dir = fsTemp.template('t2-sdk-%s').mkdirSync();
      resolve({
        path: dir,
        cleanup: () => {
          try {
            fs.removeSync(dir);
          } catch (e) {
            // If the folder no longer exists, or if the remove operation throws
            // some error, this is non-fatal to the user (the data will just
            // exist until the temp folder is cleaned) and so we swallow any
            // errors.
          }
        }
      });
    });
  }
docs: Creates a temp folder with a cleanup function. If anything goes wrong in unpacking data into a temp folder or moving it (fs.move may be non-atomic across disjoint filesystems) we want to delete the original temp folder, which could contain several hundred megabytes of now-useless data. /* istanbul ignore next