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

concatenator

v0.0.1

Published

Concatenates the contents of a directory

Downloads

8

Readme

#Concatenator

Concatenates the contents of a directory. This is useful for loading frontend JavaScript files, html templates, or any other group of files in a directory.

##concatenator.concat_dir(path,options,callback)

Concatenates all of the contents of a path asynchronously.

path String

The path of the directory

options Object

  • file_priorites Array By default files will be loaded in whatever order fs.readdir will list them. Files in this array will be loaded before others
  • exclude Array Files to be ignored

callback Function The callback is passed two arguments (err, data), where data is the contents represented as an object, string, and array

var Concatenator = require('concatenator');
var concatenator = new Concatenator();

var options = {
  file_priorities : [
  	'file3' //make sure file3 is loaded before everything else
  ]
}

concatenator.concat_dir('./dirname',options,function(err,data){
  console.log(data); /*
    {
      obj: {
      file3: 'contents of file3\n',
      file1: 'contents of file1\n',
      file2: 'contents of file2\n'
    },
    arr: [
      'contents of file3\n',
      'contents of file1\n',
      'contents of file2\n'
    ],
    string: 'contents of file3\n\ncontents of file1\n\ncontents of file2\n'
  }
  */
})

##concatenator.concat_dirs(options,callback)

options Object

  • dirs Array directories to be concatenated. Example:
{
  dirs : [
  	{
  	  path : 'dir1',
  	  file_priorities : []
  	},
  	{
  	  path : 'dir2',
  	  file_priorities : []
  	}
  ]
}

##Tests

Use npm test to run tests and see coverage to see test coverage.

Mocha and Istanbul need to be installed globally

npm install mocha istanbul -g