'How can i do this curl via axios?

I have this curl:

curl -X 'POST' 'http://127.0.0.1/?conf%3D%7B%22flag%22%3A%20%22true%22%7D' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F '[email protected]' \
  --output 'arch.zip'

I need to do it via axios. Now i trying like this:

    const fd = new FormData();

    fd.append('v', fileBuffer);

    axios({
        method: 'post',
        url: 'http://127.0.0.1/',
        params: {
             conf: {"flag": "true"}
        },
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data: fd,
    }).then(response =>console.log(response))
    .catch(error => console.log(error));

I'm a little confuse about --output flag, how can i do it?



Sources

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

Source: Stack Overflow

Solution Source