Socket
Socket
Sign inDemoInstall

rollup-plugin-node-polyfills

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-node-polyfills

rollup-plugin-node-polyfills ===


Version published
Weekly downloads
827K
increased by0.85%
Maintainers
1
Weekly downloads
 
Created

What is rollup-plugin-node-polyfills?

The rollup-plugin-node-polyfills package provides polyfills for Node.js core modules, allowing you to use Node.js-specific modules in a browser environment when bundling with Rollup.

What are rollup-plugin-node-polyfills's main functionalities?

Buffer Polyfill

This feature allows you to use the Buffer module, which is a core module in Node.js, in a browser environment. The code sample demonstrates creating a Buffer from a string and converting it to a hexadecimal string.

import { Buffer } from 'buffer';
const buf = Buffer.from('Hello World', 'utf8');
console.log(buf.toString('hex'));

Stream Polyfill

This feature allows you to use the Stream module in a browser environment. The code sample demonstrates creating a readable stream and pushing data into it.

import { Readable } from 'stream';
const readable = new Readable();
readable.push('Hello World');
readable.push(null);
readable.on('data', (chunk) => {
  console.log(chunk.toString());
});

Crypto Polyfill

This feature allows you to use the Crypto module in a browser environment. The code sample demonstrates creating a SHA-256 hash of a string.

import { createHash } from 'crypto';
const hash = createHash('sha256');
hash.update('Hello World');
console.log(hash.digest('hex'));

Other packages similar to rollup-plugin-node-polyfills

Keywords

FAQs

Package last updated on 14 Jun 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc