J
J
john_bob2020-02-10 17:53:51
JavaScript
john_bob, 2020-02-10 17:53:51

How to determine the size of a stream?

const result = await axios({
            url,
            method,
            responseType: 'stream'
        });


There is an axios request that downloads an excel file from the server.
You need to determine its size, so that if it is large - archive it.
Tell me how can I get the size of this file (result in the code) in node.js?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-02-10
@zkelo

Get the header via axios Content-Length, the file size will be indicated there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question