Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

combiner

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combiner

Flexible file-joining library with functional middleware support.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by850%
Maintainers
1
Weekly downloads
 
Created
Source

combiner is both a command-line utility and a library for merging and processing files. The basic idea behind its is to take advantage of a functional, flexible middleware that composes map/reduce/filter callbacks.

Install

From NPM: $ npm install combiner

From Source Code: $ git clone https://github.com/azer/combiner.git $ cd combiner; $ make deps $ make install

Quick Start

Besides of the API provided by the library, combiner includes a command line script to accomplish composite file merging aims.

Most basic usage example is running it without any parameters. Which produces a merge of all files on the executed directory.

$ echo "foo">a;
$ echo "bar">b;
$ echo "qux">c;
$ combiner
foo
bar
qux

Specific filenames and directories can be picked as well.

$ combiner a c
foo
qux

The goal of combiner is to provide a middleware that lets us to process these files easily;

$ combiner -map "function(el,callback){ callback(null, el.toUpperCase()) }"
FOO
BAR
QUX

The simple command above uppercases all combinerd contents, as you've supposed. The other options available are reduce and filter. Reduce option basicly replaces the default function joining the contens of the files;

$ combiner -reduce "function(a,b,callback){ callback(null,a+","+b) }"
FOO,BAR,QUX

It's quite similar with the map function as you've seen above. Unlike the map and reduce options, filter callbacks take filenames instead of the contents of the files.

$ combiner -filter "function(filename, cb){ cb(null,/^f|q/); }"
FOO
QUX

The reasion behind this approach lies on the basic design idea of the combiner library. Its body is made up of a chain of functions, applying listed operations below;

  • find all files in the working directory
  • include and flatten nested directories if any exists
  • apply filter callbacks to gathered filenames
  • apply map callbacks to the gathered filenames*
  • apply specified reduce function or the default one joining passed contents with new lines.

Dependencies

  • nodejs
  • functools

Development

status: under development todo:

  • usage example
  • extend documentation (using ronn)
  • build a website (combiner.kodfabrik.com)

Keywords

FAQs

Package last updated on 29 Feb 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc