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

npmnpm install needle

Methods

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.

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.