sync-rest-client is a synchronous, non-blocking REST/HTTP client for Node.js built on deasync and request. Version 1.0.3 uses deasync to wrap request, enabling synchronous HTTP calls without blocking the event loop. It supports retries (default 3), timeouts, and graceful error handling. Key differentiator: it avoids thread-blocking issues seen with other sync libraries like sync-request when used alongside async code. Last updated 2018, low maintenance. Use cases: scripts, CLI tools, or scenarios requiring synchronous HTTP operations without event loop blockage.
npm install sync-rest-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates GET request with options (timeout and retries) and handling the synchronous response object.
Consider migrating to async alternatives or use newer sync libraries like sync-fetch.
Use syncClient.del(url, options) for DELETE requests.
Check typeof response.body before assuming it's an object.
Use alternatives like sync-fetch or got (async) for new projects.
Use const syncClient = require('sync-rest-client'); in CommonJS.Increase timeout in options or check network/server availability.
Ensure retries property is a positive integer (e.g., retries: 2).