Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
node-libs-browser
Advanced tools
The node-libs-browser package is a collection of browser-friendly versions of Node.js core modules. It allows developers to use Node.js-style modules in the browser, providing shims and polyfills for Node.js core modules that do not have direct equivalents in the browser environment. This package is particularly useful for bundling applications with webpack, which uses it to simulate a Node.js environment in the browser.
Buffer
Provides a Buffer class that can be used for binary data manipulation in the browser, similar to Node.js's Buffer module.
var Buffer = require('buffer/').Buffer;
var buf = Buffer.from('hello world', 'ascii');
console.log(buf.toString('hex'));
Events
Implements the EventEmitter class to enable event-driven architecture in the browser, mimicking Node.js's events module.
var EventEmitter = require('events/').EventEmitter;
var emitter = new EventEmitter();
emitter.on('event', function(message) {
console.log(message);
});
emitter.emit('event', 'Hello world!');
Path
Provides utilities for file path operations, similar to Node.js's path module, but adapted for the browser.
var path = require('path-browserify');
console.log(path.basename('/foo/bar/baz/asdf/quux.html'));
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. It's similar to node-libs-browser in that it allows Node.js code to run in the browser, but it works at the bundling level, transforming Node.js modules into browser-compatible scripts.
This package is used with webpack to automatically exclude node modules. It's related to node-libs-browser in the context of building for the browser, but instead of providing browser versions of Node.js modules, it helps to avoid bundling them altogether.
A port of Node.js's crypto module to the browser. It offers similar functionality to one aspect of node-libs-browser, focusing specifically on cryptographic functions.
The node core libs for in-browser usage.
Exports a hash [object] of absolute paths to each lib, keyed by lib names. Modules without browser replacements are null
.
Some modules have mocks in the mock
directory. These are replacements with minimal functionality.
lib name | browser implementation | mock implementation |
---|---|---|
assert | defunctzombie/commonjs-assert | --- |
buffer | feross/buffer | buffer.js |
child_process | --- | --- |
cluster | --- | --- |
console | Raynos/console-browserify | console.js |
constants | juliangruber/constants-browserify | --- |
crypto | crypto-browserify/crypto-browserify | --- |
dgram | --- | --- |
dns | --- | dns.js |
domain | bevry/domain-browser | --- |
events | Gozala/events | --- |
fs | --- | --- |
http | substack/http-browserify | --- |
https | substack/https-browserify | --- |
module | --- | --- |
net | --- | net.js |
os | CoderPuppy/os-browserify | --- |
path | substack/path-browserify | --- |
process | shtylman/node-process | process.js |
punycode | bestiejs/punycode.js | --- |
querystring | mike-spainhower/querystring | --- |
readline | --- | --- |
repl | --- | --- |
stream | substack/stream-browserify | --- |
string_decoder | rvagg/string_decoder | --- |
sys | defunctzombie/node-util | --- |
timers | jryans/timers-browserify | --- |
tls | --- | tls.js |
tty | substack/tty-browserify | tty.js |
url | defunctzombie/node-url | --- |
util | defunctzombie/node-util | --- |
vm | substack/vm-browserify | --- |
zlib | devongovett/browserify-zlib | --- |
FAQs
The node core libs for in browser usage.
The npm package node-libs-browser receives a total of 3,092,347 weekly downloads. As such, node-libs-browser popularity was classified as popular.
We found that node-libs-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.