
Q
A JavaScript promise library for handling asynchronous work, now archived and superseded by native promises.
- Stars
- 15k
- Forks
- 1.2k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 3.0 years ago
- Type
- Library
This repository is archived and no longer maintained.
What it is
Q is a JavaScript library that implements promises, objects that stand in for a value a function will eventually return or an error it will eventually throw. It lets code chain steps one after another instead of nesting callbacks. The README says native JavaScript promises are now built into every modern browser and recommends using those instead, and the project is archived with no further development planned.
- Flatten nested callback code into a chain of then calls with one catch at the end
- Use fin to run cleanup code whether a promise succeeds or fails
- Wrap a function that uses callbacks so it returns a promise instead
Great for
- Developers maintaining older codebases that already depend on Q
- People studying the history of promises in JavaScript
- Developers who need the fin and fail helpers Q documents in its tutorial
Not ideal for
- New projects: the README recommends built-in JavaScript promises, which are faster and better supported
- Anyone needing active maintenance, since the README says further development has been unnecessary for years and only bugs will be fixed
How to get it
- 1
Install with a package manager
You'll need: Node.js or a browser environment
Install the npm package
npm install q - 2
Run it
- Load the module with require('q') in Node.js or include it via a script tag to get the Q global
- Wrap a promise-returning function or start with Q.fcall
- Chain .then handlers and finish with .catch or .done
- 3
Get the most out of it
- Read the API reference in the project wiki for method-by-method details
- Use fail as a shorthand for handling only errors
- Use fin for cleanup logic that should run regardless of outcome
- Consider migrating to native Promise, as the README recommends
Downloads
Strengths
- Gives a clear chained style for asynchronous code, as shown in the README examples
- Errors propagate through the chain similar to try, catch, and finally
- Documentation includes a tutorial and links to a wiki with an API reference
Trade-offs
- Archived and no longer actively developed, so it will not receive new features
- Native JavaScript promises are the recommended replacement and are faster with better tooling
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| q (this) | 15k | Library | intermediate | 3.0 years ago | Developers maintaining older codebases that already depend on Q |
| bluebird | 20.5k | Library | beginner | 2.0 years ago | Maintainers of legacy codebases that already depend on Bluebird |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.