'How would I consume the body of a put request from a web worker

I want to consume data sent through a put request in a web worker. How would I do so?

this the part in my code where I am trying to handle the put request

if (method === 'put') {
    var request = event.request;
    //how would I turn the request object into an array buffer?
}


Solution 1:[1]

You can consume the request's body as an array buffer using the .arrayBuffer() method.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bergi