dasu is a JavaScript library that aimed to provide a consistent XMLHttpRequest (XHR) API for both client-side (browser) and server-side (Node.js) environments. It abstracts away the underlying differences between `window.XMLHttpRequest` and Node's `http.request`, presenting a unified interface. The library, currently at version 0.4.3, was last published in June 2014. Its primary differentiator was simplifying basic HTTP requests with a single API across environments, which was particularly useful before the widespread adoption of Fetch API or more mature cross-platform libraries. Due to its age and lack of updates, it does not support modern JavaScript features like Promises or `async/await` and relies exclusively on CommonJS modules.
npm install dasuVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to make a GET request using dasu's `req` function with Node.js-style options and a callback.
Migrate to a modern HTTP client library such as `axios`, `node-fetch`, or the built-in `fetch` API for browsers/Node.js.
Wrap dasu calls in Promises if necessary (e.g., using `util.promisify` in Node.js) or, preferably, switch to a modern library that natively supports Promises.
Use `const dasu = require('dasu');` in Node.js environments. For browser environments, use script tags or a CJS-compatible bundler if absolutely necessary.Explicitly set `dasu.mode = 'node'` or `dasu.mode = 'browser'` if you are in a hybrid environment like Electron to ensure the correct underlying HTTP implementation is used.
Use CommonJS `require` syntax: `const dasu = require('dasu'); const req = dasu.req;`Ensure `params.protocol` is correctly specified as `'http:'` or `'https:'` (including the colon) and matches the target server's protocol.
Ensure the second argument passed to `dasu.req` is a standard Node.js-style callback function with `(err, res, data)` arguments.
No dependency data recorded yet.