Bzz FS API
Installation
npm install @erebos/bzz-fs
Usage
import { BzzFS } from '@erebos/bzz-fs'
import { BzzNode } from '@erebos/bzz-node'
const bzz = new BzzNode({ url: 'http://localhost:8500' })
const bzzFS = new BzzFS({ bzz })
BzzFSConfig
interface BzzFSConfig {
basePath?: string
bzz: BzzNode | string
}
BzzFS class
new BzzFS()
Arguments
config: BzzFSConfig, see below
Configuration
basePath?: string: the base path to resolve relative paths tobzz: BzzNode | string: theBzzNodeinstance or gateway URL
.downloadTarTo()
Arguments
hashOrDomain: string: ENS name or Swarm hashpath: string: tar file pathoptions?: DownloadOptions = {}
Returns Promise<void>
.downloadFileTo()
Arguments
hashOrDomain: string: ENS name or Swarm hashpath: stringoptions?: DownloadOptions = {}
Returns Promise<void>
.downloadDirectoryTo()
Arguments
hashOrDomain: string: ENS name or Swarm hashpath: stringoptions?: DownloadOptions = {}
Returns Promise<number> the number of files written.
.downloadTo()
Call downloadFileTo() or downloadDirectoryTo() depending on the provided path.
Arguments
hashOrDomain: string: ENS name or Swarm hashpath: stringoptions?: DownloadOptions = {}
Returns Promise<void>
.uploadTar()
Arguments
path: string: path to an existing tar archive or a directory to packoptions?: UploadOptions = {}
Returns Promise<string>
.uploadFileFrom()
Arguments
path: string: file to uploadoptions?: UploadOptions = {}
Returns Promise<string>
.uploadDirectoryFrom()
Arguments
path: string: directory to uploadoptions?: UploadOptions = {}
Returns Promise<string>
.uploadFrom()
Calls uploadFileFrom() or uploadDirectoryFrom() depending on the provided path.
Arguments
path: string: file or directory to uploadoptions?: UploadOptions = {}
Returns Promise<string>
