Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web3-bzz

Package Overview
Dependencies
Maintainers
5
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-bzz

Web3 module to interact with the Swarm network.

  • 1.10.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
312K
increased by11.47%
Maintainers
5
Weekly downloads
 
Created

What is web3-bzz?

The web3-bzz package is a module of the web3.js library that allows interaction with the Swarm decentralized storage system. It provides functionalities to upload, download, and manage files on the Swarm network.

What are web3-bzz's main functionalities?

Upload File

This feature allows you to upload a file to the Swarm network. The code sample demonstrates how to upload a simple text file and log the resulting hash.

const Web3Bzz = require('web3-bzz');
const bzz = new Web3Bzz('http://localhost:8500');

const file = new Blob(['Hello, Swarm!'], { type: 'text/plain' });
bzz.uploadFile(file).then(hash => {
  console.log('File uploaded with hash:', hash);
});

Download File

This feature allows you to download a file from the Swarm network using its hash. The code sample shows how to download a file and log its content.

const Web3Bzz = require('web3-bzz');
const bzz = new Web3Bzz('http://localhost:8500');

const hash = 'your-file-hash';
bzz.downloadFile(hash).then(file => {
  console.log('File downloaded:', file);
});

Upload Directory

This feature allows you to upload a directory to the Swarm network. The code sample demonstrates how to upload a directory containing an HTML file and a CSS file.

const Web3Bzz = require('web3-bzz');
const bzz = new Web3Bzz('http://localhost:8500');

const directory = [
  { path: 'index.html', data: '<html><body>Hello, Swarm!</body></html>' },
  { path: 'style.css', data: 'body { font-family: Arial; }' }
];
bzz.uploadDirectory(directory).then(hash => {
  console.log('Directory uploaded with hash:', hash);
});

Other packages similar to web3-bzz

FAQs

Package last updated on 18 Oct 2023

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