Registry / devops / axios-shortcut

axios-shortcut

JSON →
library0.1.4jsnpmunverified

Axios Shortcut (v0.1.4) is a lightweight wrapper around Axios that provides shorthand methods (GET, DELETE, HEAD, OPTIONS) with a separate params argument, plus a dedicated DOWNLOAD method for file downloads. It maintains the same API for POST, PUT, PATCH as Axios but omits request(config) and getUri. Since v0.1, it has offered a compact API surface with no extra runtime dependencies. Ideal for developers who want to reduce boilerplate when making GET/DELETE requests and need a simple download helper.

npm install axios-shortcut
INSTALL
IMPORT
SIG · AXIOS-SHORTCUT
A
axios-shortcut
devopsjavascriptv0.1.4
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
import AxiosShortcut from 'axios-shortcut'
const AxiosShortcut = require('axios-shortcut')
Package is ESM-only; no CommonJS export. Use default import.
GET
import { GET } from 'axios-shortcut'
import GET from 'axios-shortcut'
GET is a named export, not a default export. The default export is the AxiosShortcut constructor/object.
DOWNLOAD
import { DOWNLOAD } from 'axios-shortcut'
import { download } from 'axios-shortcut'
Function name is DOWNLOAD (uppercase).
AxiosShortcut
import AxiosShortcut from 'axios-shortcut'
import { AxiosShortcut } from 'axios-shortcut'
AxiosShortcut is the default export, not a named export.

Shows creation of AxiosShortcut instance with Axios, GET with separate params argument, POST call, and file download using DOWNLOAD.

import AxiosShortcut, { GET, DOWNLOAD } from 'axios-shortcut'; import axios from 'axios'; // Create a shortcut instance (reuses axios instance) const api = AxiosShortcut(axios.create({ baseURL: 'https://api.example.com' })); // GET with params const response = await GET('/users', { page: 1 }, { timeout: 5000 }); console.log(response.data); // POST with data (same as Axios) const postResponse = await api.POST('/users', { name: 'Alice' }); console.log(postResponse.data); // DOWNLOAD await DOWNLOAD('https://example.com/file.pdf', 'downloaded.pdf');
Debug
Known issues
gotchaMethods like GET, DELETE, HEAD, OPTIONS accept (url, params, config) unlike Axios which uses (url, config). The params argument is separate and placed before config.
fix
When migrating from raw Axios, move any query parameters (or undefined) into the second argument, and config into the third.
affects: >=0.1
breakingThe request(config) and getUri(config) methods from Axios are not available in AxiosShortcut.
fix
Use Axios instance directly if you need these methods.
affects: >=0.1
gotchaDOWNLOAD will trigger a download in a browser environment by creating a temporary anchor element. In Node.js it does nothing unless polyfilled.
fix
Only use DOWNLOAD in browser contexts or provide a Node.js polyfill for file downloads.
affects: >=0.1
breakingThe library is ESM only and does not provide a CommonJS bundle.
fix
Ensure your project uses ESM ("type": "module" in package.json) or use a bundler that can consume ESM.
affects: >=0.1
deprecatedNo version has been deprecated yet, but the API is minimal and may change in future releases.
fix
Pin to exact version if stability is critical.
affects: 0.1.x
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/axios-shortcut/index.mjs not supported.
AxiosShortcut is ESM-only; trying to require() it in a CommonJS context.
fix
Use dynamic import: const AxiosShortcut = await import('axios-shortcut'); or convert to ESM.
TypeError: axios.create is not a function
Passing an Axios instance that is not created with axios.create() or using a non-function value.
fix
Ensure you pass an Axios instance: const instance = axios.create({ baseURL: '...' });
TypeError: GET is not a function
Importing GET as default instead of named import.
fix
Use import { GET } from 'axios-shortcut' instead of import GET from 'axios-shortcut'.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
axiosrequiredpeer dependency - used as the underlying HTTP client
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
axios-shortcut — npm install axios-shortcut · libregistry