erebos

erebos

  • Docs
  • Examples
  • API
  • Help
  • GitHub

›Swarm examples

Docs

  • Introduction
  • Getting started

Swarm examples

  • File storage examples
  • Feeds examples
  • Communications examples

Swarm APIs and CLI

  • Swarm client
  • Individual APIs
  • Bzz API
  • Bzz Feed API
  • Bzz FS API
  • Pss API
  • CLI

Data structures

  • Data structures
  • Feed lists
  • Document synchronization
  • Timeline

Timeline protocol

  • Timeline specification
  • Timeline example
  • Timeline API

Utility libraries

  • Hexadecimal encoding
  • Keccak256 hashing
  • SECP256k1 signing
  • Hierarchical Deterministic wallet

RPC tools

  • RPC clients, handler and transport
  • Base RPC class and types
  • RPC Errors
  • RequestRPC client (stateless)
  • StreamRPC client (stateful)
  • RPC handler
  • RPC client over HTTP
  • RPC client over WebSocket
  • RPC client over IPC
  • RPC client for browsers
  • RPC client for Node
  • RPC client for Electron
  • HTTP transport
  • WebSocket transport
  • IPC transport
  • Electron transport
Edit

File storage examples

File storage APIs reference

Using the standalone browser library

<html>
  <script src="https://unpkg.com/@erebos/swarm-browser/dist/erebos.swarm.production.js"></script>
  <script>
    const client = new Erebos.swarm.SwarmClient({
      http: 'https://swarm-gateways.net',
    })
    client.bzz
      .uploadFile('Hello world!', { contentType: 'text/plain' })
      .then(hash => client.bzz.download(hash))
      .then(res => res.text())
      .then(text => {
        console.log(text) // "Hello world!"
      })
  </script>
</html>

Using a local Swarm node

import path from 'path'
import { BzzFS } from '@erebos/bzz-fs'
import { BzzNode } from '@erebos/bzz-node'

const bzz = new BzzNode({ url: 'http://localhost:8500' })
const bzzFS = new BzzFS({ basePath: __dirname, bzz })

bzzFS
  .uploadDirectoryFrom('my-files')
  .then(hash => bzz.list(hash))
  .then(contents => {
    console.log(contents) // Manifest contents describing the uploaded files
  })
← Getting startedFeeds examples →
  • Using the standalone browser library
  • Using a local Swarm node
Docs
Getting StartedAPI ReferenceCLI
Community
Gitter chatGitHub repositoryStar
Swarm
Official documentationHTTP gatewayDevelopment chat