restler-base is a fork of the unmaintained restler HTTP client library for Node.js, version 3.4.6. It incorporates pending pull requests and fixes from the original project, serving as the foundation for restler-promise. The library provides an event-based API for making HTTP requests with automatic serialization of post data and query strings, transparent handling of SSL, redirects, gzip/deflate, and basic auth, plus automatic deserialization of XML, JSON, and YAML responses. It supports multipart file uploads and custom deserializers. Compared to modern alternatives like axios or node-fetch, restler-base is older and uses an event-driven pattern rather than promises, though it can be wrapped with restler-promise. Release cadence is low; last release was 3.4.6. Key differentiator: it is a maintained fork of restler, preserving its specific API for legacy projects.
npm install restler-baseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic HTTP GET and POST using the event-based API with error handling via 'complete' and 'success'/'fail' events.
Always check 'result instanceof Error' in 'complete' event handler before using result.
Consider using the restler-promise wrapper for promise-based API, or migrate to axios.
Install optional dependencies: npm install xml2js yamljs
Always set timeout option to a reasonable value (e.g., 10000).
Format multipart data as { file: { file: '/path/to/file', name: 'fieldname' } }.Run 'npm install restler-base' and ensure import is from 'restler-base' not 'restler'.
Check URL and options, ensure function returns a RestRequest object before chaining .on()
Ensure target server is running, or use a valid URL.
Use .once() instead of .on() if listeners should fire only once, or manage listener removal with .removeListener().