You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chunk-store-iterator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunk-store-iterator

Convert an abstract-chunk-store compliant store into an async iterator, or write to using an async iterator.

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
9K
37.48%
Maintainers
1
Weekly downloads
 
Created
Source

chunk-store-iterator javascript style guide

Convert an abstract-chunk-store store into an async iterator, or write to using an async iterator.

abstract chunk store

A majorly simplified version of chunk-store-stream. Dependency free and very fast.

Read/write data from/to a chunk store, with iterators.

Install

npm install chunk-store-iterator

Usage

Create a read iterator

import { chunkStoreRead } from 'chunk-store-iterator'
import FSChunkStore from 'fs-chunk-store' // any chunk store will work
import { Readable } from 'streamx'

const chunkLength = 3
const store = new FSChunkStore(chunkLength)

// ... put some data in the store

const asyncIterator = chunkStoreRead(store, { length: 1200, zeroPadding: true })
const stream = Readable.from(asyncIterator)

stream.pipe(process.stdout)

// or

for await (const chunk of chunkStoreRead(store, { length: 1200 })) {
  console.log(chunk)
}

Write using an iterator

import { chunkStoreWrite } from 'chunk-store-iterator'
import FSChunkStore from 'fs-chunk-store' // any chunk store will work
import fs from 'fs'

const chunkLength = 3
const store = new FSChunkStore(chunkLength)

const stream = fs.createReadStream('file.txt')
await chunkStoreWrite(store, stream)

License

MIT.

Keywords

async

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts