npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@croco/batch-core

v0.0.2

Published

대용량 데이터 처리를 위한 배치 프레임워크입니다. Spring Batch의 개념(Reader, Processor, Writer)을 차용하여 Node.js 환경에 맞게 구현했습니다.

Readme

@croco/batch-core

대용량 데이터 처리를 위한 배치 프레임워크입니다. Spring Batch의 개념(Reader, Processor, Writer)을 차용하여 Node.js 환경에 맞게 구현했습니다.

특징

  • Chunk 지향 처리: 메모리 효율적인 대용량 데이터 처리
  • 단계별 구성 (Step & Job): 재사용 가능한 스텝과 작업 구성
  • 체크포인트 & 재시작: 실패 지점부터 재시작 가능한 구조 (Checkpointable)
  • 타입 안전성: 제네릭을 통한 입출력 타입 보장

설치

pnpm add @croco/batch-core

주요 개념

  • ItemReader: 데이터를 읽어오는 역할 (예: DB 조회, 파일 읽기)
  • ItemProcessor: 데이터를 가공하는 역할 (비즈니스 로직)
  • ItemWriter: 가공된 데이터를 저장하는 역할 (예: DB 저장, 파일 쓰기)
  • Step: Reader -> Processor -> Writer 로 구성된 단위 작업
  • Job: 하나 이상의 Step으로 구성된 전체 배치 작업

사용 방법

1. Reader, Processor, Writer 구현

import type { ItemReader, ItemProcessor, ItemWriter } from "@croco/batch-core";

// Reader
class UserReader implements ItemReader<User> {
  private offset = 0;
  async read(): Promise<User | null> {
    const users = await db.users.find({ skip: this.offset, take: 1 });
    this.offset++;
    return users[0] || null;
  }
}

// Processor
class UserActiveProcessor implements ItemProcessor<User, UserActiveEvent> {
  async process(user: User): Promise<UserActiveEvent | null> {
    if (!user.isActive) return null; // 필터링
    return { userId: user.id, timestamp: new Date() };
  }
}

// Writer
class EventWriter implements ItemWriter<UserActiveEvent> {
  async write(events: UserActiveEvent[]): Promise<void> {
    await eventBus.publishAll(events);
  }
}

2. Job 구성

JobBuilder를 사용하여 Step과 Job을 구성합니다.

import { JobBuilder, Step } from "@croco/batch-core";

const userStep = new Step({
  name: "process-active-users",
  reader: new UserReader(),
  processor: new UserActiveProcessor(),
  writer: new EventWriter(),
  chunkSize: 100,
});

const job = new JobBuilder("daily-user-batch").start(userStep).build();