hashed blob storage. on opfs. in memory. on disk. in orbit.
- ๐ฟ behemoth stores binary data, anywhere.
- ๐ content-addressable -- sha256 hashes for identity (never store a dupe)
- ๐ฎ blob-oriented -- blobs provide random-access and are generally super cool
- ๐๏ธ stream-oriented -- streams allow you to upload/download big stuff smoothly
- โป๏ธ isomorphic -- runs in browsers or node
- ๐ฐ๏ธ remote -- (coming soon) connect to a remote behemoth api service
all behemoths have the same shape
Behemoth
.has(hash: Hash): Promise<boolean>const exists = await behemoth.has(hash)
.require(hash: Hash): Promise<Blob>const blob = await behemoth.require(hash)
.get(hash: Hash): Promise<Blob | undefined>const blob = await behemoth.get(hash)
.set(blob: Blob, options?: SetOptions): Promise<Hash>const hash = await behemoth.set(blob)
const hash = await behemoth.set(blob, { onProgress: progress => { progress.total // number, total amount of work progress.done // number, amount of work completed }, })
.delete(...hashes: Hash[]): Promise<void>await behemoth.delete(hash)
store data in the browser's origin private file system
import {BehemothOpfs} from "@e280/behemoth"
const behemoth = await BehemothOpfs.mkdir("my-data")store data to disk via node fs
import {BehemothDisk} from "@e280/behemoth/node"
// ๐
const behemoth = await BehemothDisk.mkdir("./my-data")store data in memory
import {BehemothMemory} from "@e280/behemoth"
const behemoth = new BehemothMemory()handy tools you might wanna use
hashBlob(blob: Blob, onProgress: (hashed: number) => void): Promise<Hash>const hash = await hashBlob(blob)
const hash = await hashBlob(blob, hashed => { console.log(`bytes hashed: ${hashed}`) })
readBlob(blob: Blob): AsyncGenerator<Uint8Array>for await (const chunk of readBlob(blob)) chunk
readStream(stream: ReadableStream<Uint8Array>): AsyncGenerator<Uint8Array>for await (const chunk of readStream(stream)) chunk
e280.org, github stars plz
