New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-file

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-file

axios post formdata and download file

  • 1.0.17
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
383
increased by15.02%
Maintainers
1
Weekly downloads
 
Created
Source

axios-file

node 中在 axios 基础上实现文件的上传和下载

npm npm npm

GitHub forks GitHub stars

Installation

npm install axios-file

Example

上传:
const axiosFile = require('axios-file');

// 直接将 stream 传入即可

const data = {
  name: 'test',
  file: fs.createReadStream('./test.png')
};

await axiosFile({
  url: 'http://xxx.xxx/test',
  method: 'post',
  headers: {
    'cache-control': 'no-cache'
  },
  data: data
});
下载:
const axiosFile = require('axios-file');

// 下载文件并保存至指定的文件中
// savePath 必须存在,否则将走 axios 的默认规则

await axiosFile({
  url: 'http://xxx.xxx/file',
  method: 'get',
  savePath: `${__dirname}/test.png`
});

Keywords

FAQs

Package last updated on 29 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc