title: Receiving the Progress as a File Uploads
body: <p>I have some code that uploads a file and I am looking for a way to receive back the progress percentage so I can feed that into a progress bar. I tried ProgressEventInit and ProgressEvent but I have had no luck getting what I need. Anyone have any ideas. Below is the code:</p>
  <pre><code>function objToQuery(obj: {[key: string]: any}) {
    if (R.isEmpty(obj)) {
      return '';
    }
    return `?${R.toPairs(obj).map(kvPair =&gt; kvPair.join('=')).join('&amp;')}`;
  }
  
  export default async function request&lt;T&gt;(url: string, options: RequestInit) {
    const response = await window.fetch(url, { credentials: 'include', ...options });
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    const json = (await parseJSON&lt;T&gt;(response))!;
    return checkStatus(response, json);
  }
  
  export async function postFiles&lt;T&gt;(url: string, postForm: FormData, queryData: {} = {}) {
    const headers: HeadersInit = {
      Accept: 'application/json',
    };
  
    return request&lt;T&gt;(`${apiRoot}/${url}${objToQuery(queryData)}`, {
      headers,
      method: 'POST',
      body: postForm,
    });
  }
  </code></pre>