Hypercore is a fundamental module in Dat's ecosystem.
It works as an append-only log providing all the mechanisms necessary to work with and share big volumes of data in a distributed and secure manner.
First, let's take a look at what hypercore looks like. It's just a function we can call and will return a feed.
const hypercore = require('hypercore')
const feed = hypercore('./my-first-dataset', {valueEncoding: 'utf-8'})- Write a function that returns an hypercore
feedusing a memorystorage. - Setup the instance for handling
jsondata. - Before returning the
feed, add the following object:{ title: 'dat-is-freedom' }.
hypercoretakes as a first parameter a function that defines thestorage. This function must follow the random-access-storage interface.- If we give hypercore a filepath instead of a
storagefunction,hypercorewill use random-access-file as a default storage. - If you take a look into the
hypercoreoptions you will see that we can specify the type of codec to use for parsing the data.
$ npm test ./02