New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@warren-bank/browser-fetch-progress

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@warren-bank/browser-fetch-progress

A middleware function for use with the browser 'Fetch API' to provide download progress updates.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

fetchProgress

A middleware function for use with the browser Fetch API to provide download progress updates.

CDN
Usage
  const buffer = await fetch(url)
    .then(fetchProgress(event => console.log(`download is ${event.progress * 100} percent complete..`)))
    .then(res => res.arrayBuffer())
Examples
Notes
  • fetchProgress is a function
    • it accepts 1 input parameter
      • an event handler function
      • lets call it progressHandler
  • progressHandler is a function
    • it accepts 1 input parameter
      • an Object
      • lets call it event
        • it has 1 attribute
          • name: progress
          • value: number within the inclusive range 0 to 1
    • it returns a Promise that resolves to an instance of a class
      • having the following public methods:
        • arrayBuffer()
        • blob()
        • bytes()
        • json()
        • text()
      • having the following public properties:
        • headers
        • ok
        • redirected
        • status
        • statusText
        • type
        • url
      • these public methods and properties can be used as drop-in replacements for several of the methods and properties provided by the Response class, with the following caveats:
        • headers is a plain key/value Object, rather than an instance of the Headers class
Credits

FAQs

Package last updated on 10 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc