github internxt/drive-web v1.0.764

5 hours ago

Description

The purpose of this PR is to capture and log information about file or folder uploads using the Network Information API. How it works:

Each successful upload generates a log containing the upload context and the connection status at that moment. This log includes:

  • file or folder name,
  • size in bytes
  • connection type,
  • effective type
  • estimated download speed,
  • maximum speed
  • latency
  • whether data-saving mode is enabled.

A new module has been created in src/app/network/networkInformation.ts to centralize this functionality. Here are two functions: getNetworkInformation(), which returns the 6 API fields, or null if the browser does not support it, and logNetworkInfoForUpload(context), which combines the upload context with the network information and outputs it to the console.

The functionality has been integrated into three existing upload flows: UploadManager.ts, UploadFolderManager.ts, and uploadFolderThunk.ts.

The log is only output when the upload completes successfully. If the browser does not support the Network Information API, as is the case with Safari or Firefox, the upload proceeds normally and no additional information is logged.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

To test this feature, a preview deployment was used at https://0559a382.drive-web.pages.dev/ and verified across Chrome, Safari, and Firefox.

Chrome — Network Information API is supported. After a successful file or folder upload, the following log appears in the console:

[Upload] Network information: { fileName: "...", fileSize: ..., effectiveType: "4g", downlink: 9.8, rtt: 0, saveData: false, type: undefined, downlinkMax: undefined }
type and downlinkMax are undefined as expected — Chrome does not implement those two fields on desktop.

Safari — Network Information API is not supported. Uploads complete successfully with no network log and no errors in the console.

Firefox — Network Information API is intentionally disabled by Mozilla for privacy reasons. Uploads complete successfully with no network log and no errors in the console.

Additional Notes

Don't miss a new drive-web release

NewReleases is sending notifications on new releases.