Registry / http-networking / requestify

requestify

JSON →
library1.1.0jsnpmunverified

Requestify is an HTTP client for Node.js, designed to simplify making HTTP requests and provide built-in caching capabilities. It utilizes the Q promise library for asynchronous operations, returning promises for all network calls. As of its last major release, version 0.2.5 (published in 2016), it supports in-memory, Redis, and MongoDB caching via pluggable transporters. The package was primarily built for Node.js environments around `~0.10.x`, making it incompatible with modern Node.js runtimes. Its key differentiators at the time were its promise-based API (using Q) and an extensible caching mechanism. The project appears to be abandoned, with no significant updates or maintenance for nearly a decade.

npm install requestify
INSTALL
IMPORT
SIG · REQUESTIFY
R
requestify
http-networkingjavascriptv1.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

requestify
const requestify = require('requestify');
import requestify from 'requestify';
Requestify is a CommonJS module and must be imported using `require()`. ESM imports will not work.
requestify.get
requestify.get('http://example.com').then(...);
requestify().get('http://example.com');
HTTP methods are directly available on the default exported `requestify` object.
requestify.coreCacheTransporters
const coreCacheTransporters = requestify.coreCacheTransporters;
import { coreCacheTransporters } from 'requestify';
Nested properties like `coreCacheTransporters` are accessed via the main `requestify` object, not through named ESM imports.

This quickstart demonstrates basic GET and POST requests, shows how to set encoding, and illustrates the use of Requestify's built-in caching mechanism with the default in-memory transporter. It highlights the promise-based nature of the API using the `then` method.

const requestify = require('requestify'); async function performRequests() { // Set a custom encoding (optional, utf8 is default) requestify.setEncoding('utf8'); // Example GET request console.log('Performing GET request...'); try { const getResponse = await requestify.get('https://httpbin.org/get').then(function(response) { return response.getBody(); // Q-promise .then() }); console.log('GET Response Body:', getResponse); } catch (error) { console.error('GET Error:', error.message || error.code || error); } // Example POST request with JSON body console.log('\nPerforming POST request...'); try { const postResponse = await requestify.post('https://httpbin.org/post', { hello: 'world', timestamp: new Date().toISOString() }).then(function(response) { return response.getBody(); // Q-promise .then() }); console.log('POST Response Body:', postResponse); } catch (error) { console.error('POST Error:', error.message || error.code || error); } // Example GET request with caching enabled (requires cache transporter setup) console.log('\nPerforming cached GET request...'); // Using the default in-memory cache transporter const coreCacheTransporters = requestify.coreCacheTransporters; requestify.cacheTransporter(coreCacheTransporters.inMemory()); try { const cachedGetResponse = await requestify.get('https://httpbin.org/delay/1', { cache: { cache: true, expires: 5000 } // Cache for 5 seconds }).then(function(response) { return response.getBody(); }); console.log('Cached GET Response Body (first call):', cachedGetResponse); // Immediately fetch again, should be from cache if within 5 seconds const cachedGetResponse2 = await requestify.get('https://httpbin.org/delay/1', { cache: { cache: true, expires: 5000 } }).then(function(response) { return response.getBody(); }); console.log('Cached GET Response Body (second call, should be fast):', cachedGetResponse2); } catch (error) { console.error('Cached GET Error:', error.message || error.code || error); } } performRequests();
Debug
Known issues
breakingRequestify requires Node.js version ~0.10.x. It is largely incompatible with modern Node.js versions (v12+). Running it on newer Node.js runtimes will likely result in unexpected behavior or errors due to API changes and removed core modules.
fix
This package is not recommended for new projects. Consider modern alternatives like `axios`, `node-fetch`, or `undici`. For existing projects, consider a shim or a rewrite, as upgrading Node.js is critical for security and performance.
affects: >=0.2.5
gotchaRequestify uses the 'Q' promise library for asynchronous operations, not native ES6 Promises. Developers expecting native Promise behavior (e.g., `catch()` instead of `fail()`, `finally()`) or interoperability might encounter issues.
fix
Be mindful of Q's API for promises, including `.then(onFulfilled, onRejected)` and `.fail(onRejected)` for error handling. Avoid mixing with native Promises unless using `Q.fcall(asyncFn)` to wrap native async functions.
affects: >=0.2.0
deprecatedThe `requestify.redis(redisInstance)` method is deprecated. Users should instead configure the Redis cache transporter directly via `requestify.cacheTransporter(requestify.coreCacheTransporters.redis(myRedisInstance));`.
fix
Replace calls to `requestify.redis()` with `requestify.cacheTransporter(requestify.coreCacheTransporters.redis(myRedisInstance));` for proper configuration and future compatibility.
affects: >=0.2.0
gotchaThe Requestify project appears to be abandoned. Its last publish date was 9 years ago (2016), and it targets a very old Node.js engine (~0.10.x). This means it receives no security updates, bug fixes, or new features.
fix
Do not use Requestify for new projects. For existing projects, migration to a maintained HTTP client is strongly advised to avoid security vulnerabilities and ensure compatibility with modern infrastructure.
affects: >=0.2.5
gotchaRequestify lacks native TypeScript support and modern JavaScript features (e.g., `async/await` syntax, `fetch` API alternatives). This can lead to less ergonomic code and challenges in TypeScript-first projects.
fix
Consider using a modern HTTP client designed for TypeScript and contemporary JavaScript, which provides type definitions and supports modern language features out-of-the-box.
affects: >=0.2.0
Errors
Common errors & fixes
Error: Cannot find module 'requestify'
The package `requestify` is not installed or the `require()` path is incorrect.
fix
Ensure `requestify` is listed in your `package.json` dependencies and installed via `npm install` or `yarn install`. Verify the `require('requestify')` statement is correct.
TypeError: requestify.get is not a function
The `requestify` module was not successfully loaded or the object is not the expected Requestify instance. This can happen with incorrect `require()` usage or if a different module is aliased as `requestify`.
fix
Confirm `const requestify = require('requestify');` executed without error. Check for any naming conflicts in your scope that might be overwriting the `requestify` variable.
UnhandledPromiseRejectionWarning: DeprecationWarning: A promise was rejected with a non-error: [object Object]
This warning, often seen in older Node.js versions or with specific promise libraries like Q, indicates that a promise rejected with a value that is not an `Error` object, or that a promise rejection was not caught.
fix
Always reject promises with `new Error('message')` instead of plain strings or objects. Ensure all promises have a `.fail()` or `.then(null, onRejected)` handler to catch rejections. Upgrade Node.js if possible, as this warning might be indicative of other compatibility issues.
ReferenceError: Promise is not defined
This error occurs in very old Node.js environments where native ES6 `Promise` is not globally available, or if transpilation targets an environment without `Promise`.
fix
While `requestify` uses `Q` promises (which does not depend on native `Promise`), attempting to use native `Promise` methods without a polyfill in old Node.js (~0.10.x) would cause this. Ensure you are exclusively using `Q`'s promise API or explicitly polyfill `Promise` if mixing.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
qrequiredCore promise library used for all asynchronous operations.
redisoptionalRequired if using the Redis cache transporter for persistent caching.
mongooseoptionalRequired if using the MongoDB cache transporter for persistent caching.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
requestify — npm install requestify · libregistry