Skip to content

Instantly share code, notes, and snippets.

@supersuryaansh
Created May 12, 2025 04:29
Show Gist options
  • Save supersuryaansh/d829a7f95ed914fd0b99a4e02ae9ab59 to your computer and use it in GitHub Desktop.
Save supersuryaansh/d829a7f95ed914fd0b99a4e02ae9ab59 to your computer and use it in GitHub Desktop.
Write and read hypercore records
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