node-script-utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

node-script-utils

A set of simple utilities for writing scripts in nodejs.

Installation

npm

npm i --save node-script-utils

yarn

yarn add node-script-utils

Usage

Examples:

import { processInParallel } from 'node-script-utils';

...

const lotsOfRecords = await getLotsOfRecortds()

await processInParallel(lotsOfRecords, processRecordAsync, 10) // process all records 10 records at a time

Utlis

  • splitIntoBatches - splits array into batches of cetain size
  • processInParallel - executes an async function on each item in an array with a given parallelism number
  • createFileLog - stream logs into file
  • progress - log progress replacing the same line
  • promiseToWait - awaits timeout
  • createTiming - track elapsed time and estimate time till completion

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i node-script-utils

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

23.2 kB

Total Files

28

Last publish

Collaborators

  • antonrublev