Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
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 1,989,744 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.