API Reference
Needle
Lightweight HTTP client for Node.js supporting multipart, streaming, and proxies with a small footprint.
Official Documentation ↗CompatibilityThis documentation covers version
v3.3. Check the official docs for the latest API surface.Installation
npm
npm install needleMethods
No methods match this filter.
needle wraps the Node http module with convenience methods for common verbs and returns promises.
Key Features
- Simple get, post, put, delete helpers
- Automatic JSON parsing for object bodies
- Multipart and streaming support
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/tomas/needle@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:07.003Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Besides method and url, all parameters are optional, although when sending a post, put or patch request you will get an error if data is not present. (https://cdn.jsdelivr.net/gh/tomas/needle@latest/README.md)
- If passed, the callback will return three arguments: error, response and body, which is basically an alias for response.body. (https://cdn.jsdelivr.net/gh/tomas/needle@latest/README.md)
- Event: ‘done’ (previously ‘end’) - exception (optional) Emitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. (https://cdn.jsdelivr.net/gh/tomas/needle@latest/README.md)
FAQ
- Does needle follow redirects?
- Yes by default. Set follow_max to control the depth, or disable following when you need to inspect the 3xx response directly.
- How do I upload a file?
- Pass { multipart: true } with a data object containing file fields, or provide a stream in the body and let needle stream it.
- How are errors reported?
- Non-2xx responses still resolve; check res.statusCode. Only transport-level failures reject, so always validate the status.
Report a problem with this API docOpens a pre-filled issue on GitHub.