Registry / storage / axios-stream

axios-stream

JSON →
library1.0.17jsnpmunverified

axios-stream (v1.0.17) is a lightweight, browser-only library that wraps axios to download files as streams using Blob objects. It simplifies the process of triggering file downloads via an HTTP request made with axios, automatically creating a download link and clicking it. The package is intended solely for web projects and requires axios as a peer dependency (install separately). Its main differentiator is simplicity: a single static method `download` that takes a filename, extension, and axios config. The library is rarely updated (last release dates not specified, but low activity). Compared to alternatives like `file-saver`, it tightly integrates with axios configs.

npm install axios-stream
INSTALL
IMPORT
SIG · AXIOS-STREAM
A
axios-stream
storagejavascriptv1.0.17
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (AxiosStream)
import AxiosStream from 'axios-stream';
const AxiosStream = require('axios-stream');
The library is an ESM package; CommonJS require might not work in all bundlers.
download
import { download } from 'axios-stream';
Named export available; same as the default export's method.
AxiosStream
const { default: AxiosStream } = require('axios-stream');
const AxiosStream = require('axios-stream').AxiosStream;
When using CommonJS, you must destructure the default export.

This code demonstrates downloading a file stream via axios using axios-stream library. It sets a filename, extension, and axios configuration, then triggers the download.

import AxiosStream from 'axios-stream'; const downFileName = 'report'; const extensionName = 'csv'; const axiosConfig = { method: 'get', url: 'https://api.example.com/export', responseType: 'blob', headers: { Authorization: `Bearer ${process.env.API_TOKEN ?? ''}` } }; AxiosStream.download(downFileName, extensionName, axiosConfig);
Debug
Known issues
breakingaxios-stream is browser-only. Will throw errors in Node.js environments unless polyfilled.
fix
Only use in browser applications or configure a Blob polyfill in Node.
affects: >=1.0.0
gotchaThe file name parameter must include the extension separately; the method does not append extension automatically.
fix
Always pass the extension as the second argument, e.g., 'xlsx'.
affects: >=1.0.0
deprecatedNo known deprecations or supply chain issues as of writing.
fix
N/A
affects: none
Errors
Common errors & fixes
Uncaught TypeError: Cannot read properties of undefined (reading 'download')
You forgot to install axios as a peer dependency or imported the wrong default export.
fix
Run 'npm install axios' and ensure import statement is correct: import AxiosStream from 'axios-stream';
Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.
The response data is not a Blob or the axios config is missing responseType: 'blob'.
fix
In axiosConfig, set responseType: 'blob'
axios_stream_1.default.download is not a function
Using CommonJS require incorrectly (e.g., require('axios-stream').download instead of default).
fix
Use import AxiosStream from 'axios-stream'; or const { default: AxiosStream } = require('axios-stream');
Upgrade
Version history
1.0.17latest on npm
Audit
Dependencies
axiosrequiredThis library is a supplement to axios and requires it to make HTTP requests.
Agent activity
42 hits · last 30 days
node
34
Amazon
1
OpenAI (training)
1
Resources
axios-stream — npm install axios-stream · libregistry