Registry / http-networking / dasu
library0.4.3jsnpmunverified

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 dasu
INSTALL
IMPORT
SIG · DASU
D
dasu
http-networkingjavascriptv0.4.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

req
const dasu = require('dasu'); const req = dasu.req;
import { req } from 'dasu';
dasu is a CommonJS module, published in 2014. It does not provide ESM exports.
dasu
const dasu = require('dasu');
import dasu from 'dasu';
The entire library is exposed as a single CommonJS module export. Destructuring imports will not work as expected for non-exported properties.

This quickstart demonstrates how to make a GET request using dasu's `req` function with Node.js-style options and a callback.

const dasu = require('dasu'); const req = dasu.req; // Same parameters as Node's require('http').request const params = { method: 'GET', protocol: 'http', hostname: 'uinames.com', port: 80, path: '/api/', }; req(params, function (err, res, data) { if (err) { console.error('Request failed:', err.message); return; } console.log('Status Code:', res.statusCode); console.log('Headers:', res.headers); try { const json = JSON.parse(data); console.log('Response Data:', json); } catch (parseError) { console.error('Failed to parse JSON:', parseError.message); console.log('Raw Data:', data.toString()); } }); // Optionally, disable auto-follow redirects dasu.follow = false; // Optionally, force mode 'node', 'browser', 'auto' dasu.mode = 'auto'; // Uses window.XMLHttpRequest if available
Debug
Known issues
breakingThe `dasu` package is severely outdated, with its last release (0.4.3) dating back to June 2014. It has not received updates for over a decade and is considered abandoned. It lacks modern JavaScript features, security patches, and bug fixes.
fix
Migrate to a modern HTTP client library such as `axios`, `node-fetch`, or the built-in `fetch` API for browsers/Node.js.
affects: <=0.4.3
gotchadasu relies on a traditional Node.js callback pattern for asynchronous operations (`(err, res, data) => {}`). It does not support Promises, async/await syntax, or other modern async control flow mechanisms, making integration with contemporary JavaScript codebases challenging.
fix
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.
affects: <=0.4.3
gotchaThe library primarily supports CommonJS module syntax (`require`). There are no official ES module (ESM) exports, meaning direct `import` statements will fail without a CommonJS-to-ESM transpilation step, which is generally not recommended for abandoned libraries.
fix
Use `const dasu = require('dasu');` in Node.js environments. For browser environments, use script tags or a CJS-compatible bundler if absolutely necessary.
affects: <=0.4.3
gotchaThe `dasu.mode` property allows forcing 'node', 'browser', or 'auto'. In environments like Electron or certain testing setups, `dasu.mode = 'auto'` might incorrectly detect the environment, leading to unexpected behavior or API mismatches.
fix
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.
affects: <=0.4.3
Errors
Common errors & fixes
TypeError: dasu is not a function or dasu.req is undefined
Attempting to use `import dasu from 'dasu'` or `import { req } from 'dasu'` with a CommonJS-only library.
fix
Use CommonJS `require` syntax: `const dasu = require('dasu'); const req = dasu.req;`
Error: Protocol 'http:' not supported. Expected 'http:' or 'https:'
Incorrect or missing `protocol` in the request `params` object, especially when making requests to non-standard ports or local services.
fix
Ensure `params.protocol` is correctly specified as `'http:'` or `'https:'` (including the colon) and matches the target server's protocol.
Callback must be a function.
The second argument to `dasu.req` is not a function, or a Promise/async/await syntax was mistakenly used.
fix
Ensure the second argument passed to `dasu.req` is a standard Node.js-style callback function with `(err, res, data)` arguments.
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
dasu — npm install dasu · libregistry