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 🙏

© 2024 – Pkg Stats / Ryan Hefner

files-stream

v1.0.9

Published

Module for node.js and io.js for files concatenation on fly.

Downloads

22

Readme

Files stream

The Io.js and Node.js module for concatenation files on fly. Basically for the textual files's formats only.

|What's here?| INSTALL | USAGE | API |TESTS| |---| --- | --- | ---|---|

Installation

Module can be installed either via git or via npm. Before, you have to installed io.js or node.js and git. After all, you can clone this repo (for latest version) or just run command below:

$ npm install files-stream

Example Usage

$ node example.js // in module directory
//  example.js

var WS            = require("fs").WriteStream;
var FSS           = require("./");
new FSS({delimiter : '\r\nI\'m between each file!\r\n', encoding  : 'ASCII'},
        './test/file.4.txt',
        './test/file.2.txt',
        './test/file.3.txt',
        './test/file.1.txt') // file does not exists
        .on("error", function (err) {
            if (err) console.log(" Ooops! \r\n",err.message);
        })
        .on('end' ,console.log.bind(console,'If there is no errors you will able to see me only once!'))
        .pipe(new WS("./my.three.files.txt"))

Epress integration:

// Warninig: Don't use this module in production!
// Because module haven't yet data bufferization it still remains some troubles in files reading
// process, so because you have to use this module for development only.
// See below for more info about express integration.
var express     = require('express')
var streamOf    = require('files-stream').express
var myApp       = express()
	myApp.get('/bundle.js',streamOf(''))
    myApp.listen(8080)

API

All module's interfaces (including options parameter and events) are inherited of the Readable stream and Events emitter classes:


var FSS  = require("../path to module/");
new FSS('./file/path'[,'./file/path'|options])
        .setEncoding('utf8')
        .on("readable" ,handler)
        .on("error"    ,handler)
        .on("data"     ,handler)
        .on("end"      ,handler)
// or...
new FSS(options).addFiles(['./file/path'[,'./file/path']]).on(//etc)
// For Express
var expressApp.get( /**/,FSS.express('./file/path'[,'./file/path'|options]))

Static FSS.express() method resembles the same behavior of the files-stream Class constructor but standing simple callback function.

Where options are optional and can be placed in arbitrary place of arguments order.

|Possible options|Default|Description| |--- |--- |--- | |options.delimiter | r\n\ | String-delimiter. Placed only between two files. If error occurs on some file, will be placed in order before this erroneous file| |options.encoding | utf8 | Resembles .setEncoding() method which set up encoding to read each file|

Testing

$ mocha

License

MIT.

To do

  • [ ] Bufferization
  • [x] ~~Express integration~~
  • [x] ~~More examples~~~~

npm package