ajax-request is a basic, callback-based HTTP client library designed for Node.js, offering functionalities for sending GET and POST requests, as well as direct file downloads. Currently at version 1.2.3, this package appears to have an inactive or ceased release cadence, with its last update occurring approximately 8 years ago. Key differentiators include its straightforward API for common HTTP operations and built-in file downloading, which was more unique at the time of its active development. However, it significantly lags behind modern HTTP clients, lacking support for Promises/async-await and ES Modules, and does not ship with TypeScript definitions. The `base64` utility method has been deprecated and migrated to a separate package, signaling a lack of ongoing maintenance for this core library.
npm install ajax-requestVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to perform a simple GET request, a POST request with JSON data, and download a file using the callback-based API of `ajax-request`.
Consider migrating to a modern HTTP client library for Node.js such as `axios`, `node-fetch`, or the built-in `fetch` API (available in Node.js >= 18) for better security, features, and maintainability.
Ensure your project uses `require()` for importing `ajax-request`. For new projects, consider using a modern library that supports ES Modules or the native Node.js `fetch` API.
For base64 image functionality, refer to the `base64-img` package or implement the conversion manually using Node.js's built-in `Buffer` and file system modules.
Migrate to a actively maintained HTTP client. If immediate migration is not possible, for testing or specific controlled environments, Node.js can be run with `NODE_TLS_REJECT_UNAUTHORIZED='0'` (NOT recommended for production) or a custom agent with `rejectUnauthorized: false` for `http.request` based calls, but this is a significant security risk.
Manually create declaration files (e.g., `ajax-request.d.ts`) or use a modern HTTP client that provides official TypeScript support.
Change `import request from 'ajax-request';` to `const request = require('ajax-request');` and ensure your project is configured for CommonJS or uses dynamic `import()` if mixed modules are necessary.Ensure that a function is passed as the `callback` argument to `request()`, `request.post()`, or `request.download()` methods.
Update Node.js to a recent version. If the server uses a self-signed certificate in a controlled environment, you might temporarily set `NODE_TLS_REJECT_UNAUTHORIZED='0'` (NOT for production) or add the certificate to your trusted store. The best fix is to migrate to a modern, maintained HTTP client library.
No dependency data recorded yet.