mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
adding sample code to GET images
This commit is contained in:
@@ -125,6 +125,18 @@ axios({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// GET request for remote image
|
||||||
|
axios({
|
||||||
|
method:'get',
|
||||||
|
url:'http://bit.ly/2mTM3nY',
|
||||||
|
responseType:'stream'
|
||||||
|
})
|
||||||
|
.then(function(response) {
|
||||||
|
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
##### axios(url[, config])
|
##### axios(url[, config])
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user