Created
May 12, 2025 04:29
-
-
Save supersuryaansh/d829a7f95ed914fd0b99a4e02ae9ab59 to your computer and use it in GitHub Desktop.
Write and read hypercore records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Hypercore from 'hypercore' | |
const core = new Hypercore('./directory', {valueEncoding: 'utf-8'}) | |
await core.ready() | |
for (let x = 1; x <=10000; x++) { | |
await core.append(`${x}`) | |
} | |
const fullStream = core.createReadStream({ start: 9900, end: 9910}) | |
for await (const data of fullStream) { | |
console.log('data:', data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment