https://github.com/zhike-team/axios-upload
https://github.com/zhike-team/axios-upload
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zhike-team/axios-upload
- Owner: zhike-team
- Created: 2018-05-25T07:11:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-05T00:52:31.000Z (over 4 years ago)
- Last Synced: 2025-01-22T20:51:50.589Z (6 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## axios-upload
node 中在 axios 基础上上传表单数据
[](https://github.com/zhike-team/axios-upload/fork)
[](https://github.com/zhike-team/axios-upload)### Installation
```
npm i @zhike/axios-upload
```### example
```
const axiosUpload = require('axios-upload');// 这里直接将 stream 传入即可
// 文件默认上传最大为100M,若需修改,使用maxContentLength参数,单位byte
const data = {
name: 'test',
filedata: fs.createReadStream('./test.png')
};await axiosUpload({
url: 'http://xxx.xxx/test',
method: 'post',
headers: {
'cache-control': 'no-cache'
},
data: data
});
```