Registry / http-networking / kew
library0.2.1jsnpmunverified

kew is a lightweight promise/deferred library specifically designed for Node.js environments. Developed by Medium, its primary goal was to offer a high-performance alternative to the Q library, particularly for server-side applications experiencing CPU bottlenecks in chained database callbacks. Currently at version 0.7.0, the package appears to be unmaintained, with its last commit dating back several years, indicating an abandoned status and no active release cadence. It provides a subset of promise functionality, including methods like `Q.resolve()`, `Q.reject()`, `Q.defer()`, and promise chaining with `.then()` and `.fail()`. Unlike more comprehensive promise libraries, kew intentionally implements only the features necessary for the common server-side use cases identified by its original developers, prioritizing minimal footprint and speed.

npm install kew
INSTALL
IMPORT
SIG · KEW
K
kew
http-networkingjavascriptv0.2.1
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.

Q
const Q = require('kew')
import Q from 'kew'
kew is a CommonJS-only library. Attempting to use ESM `import` syntax will result in a `SyntaxError` in Node.js environments unless a transpilation step is used, which is generally not recommended for this abandoned library.
defer
const Q = require('kew'); const deferred = Q.defer();
import { defer } from 'kew'
All core functionality, including the `defer` method, is exposed as properties on the main `Q` object exported by the module. There are no named exports for individual methods.
PromiseConstructor
const Q = require('kew'); const promise = Q.resolve('value');
import { Promise } from 'kew'
kew provides its own promise constructor via the `Q` object. It does not export a `Promise` class directly. Modern applications should generally use the native global `Promise` constructor.

Demonstrates `Q.resolve()`, `Q.defer()`, handling deferred promises, and using `makeNodeResolver()` to integrate with Node.js-style callbacks, including error handling.

const Q = require('kew'); // 1. Create a promise from a literal value const successPromise = Q.resolve('Hello from kew!'); successPromise.then(function(message) { console.log('Resolved with:', message); }); // 2. Create a deferred promise and resolve it later const myDeferred = Q.defer(); setTimeout(function() { myDeferred.resolve('Delayed success!'); }, 500); myDeferred.promise.then(function(result) { console.log('Deferred resolved with:', result); }); // 3. Handle node-style callbacks with makeNodeResolver function getNodeStyleData(id, callback) { setTimeout(() => { if (id === 1) { callback(null, { id: 1, name: 'Item 1' }); } else { callback(new Error('Item not found!')); } }, 200); } const dataDefer = Q.defer(); getNodeStyleData(1, dataDefer.makeNodeResolver()); dataDefer.promise .then(function(obj) { console.log('Node-style callback success:', obj); }) .fail(function(e) { console.error('Node-style callback error:', e.message); }); const errorDefer = Q.defer(); getNodeStyleData(2, errorDefer.makeNodeResolver()); errorDefer.promise .then(function(obj) { console.log('Node-style callback success (should not happen):', obj); }) .fail(function(e) { console.error('Node-style callback error (expected):', e.message); });
Debug
Known issues
breakingkew implements only a subset of features found in other promise libraries like Q. Developers migrating from other promise libraries or expecting full Promise A+ compliance may encounter missing functionalities or different behaviors.
fix
Thoroughly review kew's documentation and source code to confirm feature availability. For modern applications, consider using native ES6 Promises or actively maintained alternatives.
affects: >=0.5.0
gotchaThe kew library is abandoned, with its last release (v0.7.0) several years ago. This means it receives no further updates, bug fixes, or security patches, making it unsuitable for new projects or critical production environments.
fix
Migrate to a currently maintained promise library or utilize native ES6 Promises (supported in Node.js v6+).
affects: >=0.5.0
gotchakew is a CommonJS-only module and does not natively support ES Modules (ESM) `import`/`export` syntax. Attempting to use `import Q from 'kew'` directly in an ESM context will fail.
fix
For CommonJS projects, use `const Q = require('kew')`. For ESM projects, consider using a different, actively maintained promise library that supports ESM, or native `Promise`.
affects: >=0.5.0
gotchakew predates modern JavaScript features like `async/await`. While its promises can interoperate with `async/await` if 'promisified' using utility functions (e.g., Node.js `util.promisify`), it does not offer direct support for these constructs, leading to less ergonomic code compared to native promises.
fix
Wrap kew promise-returning functions with `util.promisify` if necessary, or refactor to use native ES6 Promises for direct `async/await` compatibility.
affects: >=0.5.0
gotchaThe package does not ship with TypeScript declaration files (.d.ts). This makes it challenging to use in TypeScript projects without manually creating declaration files or resorting to `any` types.
fix
Consider creating a custom `kew.d.ts` file or migrating to a promise library that provides TypeScript support out-of-the-box.
affects: >=0.5.0
Errors
Common errors & fixes
ReferenceError: Q is not defined
The `kew` library was not correctly imported or its export was not assigned to the `Q` variable.
fix
Ensure `const Q = require('kew');` is present and correctly scoped before `Q` is used.
TypeError: kew is not a function
Attempting to invoke the `kew` module directly as a function (e.g., `new kew()`) instead of accessing its exported `Q` object.
fix
Access the `Q` object after requiring the module: `const Q = require('kew'); const promise = Q.resolve('value');`
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax (e.g., `import Q from 'kew'`) in a Node.js CommonJS environment.
fix
Use the CommonJS `require` syntax: `const Q = require('kew');`
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources