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

@freik/dos2unix

v0.1.0

Published

A Node.js module to convert text files with DOS line breaks to Unix line breaks, i.e. like using `dos2unix`.

Downloads

5

Readme

Build Status

dos2unix

A Node.js module to convert text files with DOS line breaks to Unix line breaks, i.e. like using dos2unix. The module also supports cross-platform globbing patterns.

Getting Started

Install the module with: npm install dos2unix

var D2UConverter = require('dos2unix').dos2unix;
var d2u = new D2UConverter({ glob: { cwd: __dirname } })
  .on('error', function(err) {
    console.error(err);
  })
  .on('end', function(stats) {
    console.log(stats);
  });
d2u.process(['docs/*']);

Examples

// Reference the module
var D2UConverter = new require('dos2unix').dos2unix;

// Setup default options
var defaultOptions = {
  glob: {
    cwd: __dirname
  },
  maxConcurrency: 50
};

// Create a new `dos2unix` instance and add important event listeners
var d2u = new D2UConverter(defaultOptions)
  .on('error', function(err) {
    console.error(err);
  })
  .on('end', function(stats) {
    console.log(stats);
  });

// Convert line endings of a single non-binary, non-irregular file from
// '\r\n' to '\n'.
d2u.process(['docs/README.txt']);

// Convert the line endings of multiple non-binary, non-irregular files from
// '\r\n' to '\n'.
d2u.process(['docs/README.txt', 'examples/HelloWorld.js']);

// Convert the line endings of all non-binary and non-irregular files in the
// 'docs' directory (non-recursively) from '\r\n' to '\n'.
d2u.process(['docs/*']);

// Convert the line endings of all non-binary and non-irregular files under the
// 'examples' directory (RECURSIVELY) from '\r\n' to '\n'.
d2u.process(['examples/**/*']);

// Convert the line endings of all non-binary and non-irregular files in the
// 'docs' directory (non-recursively) AND the same type of files under the
// 'examples' directory (RECURSIVELY) from '\r\n' to '\n'.
d2u.process(['docs/*', 'examples/**/*']);

// Override the globbing options (per the `glob` module's documentation)
var globOptions = {
  glob: {
    cwd: 'docs'
  }
};
d2u.process(['*.txt'], globOptions);

Events

  • start
  • processing.start
  • processing.skip
  • convert.start
  • convert.error / convert.end
  • processing.error / processing.end
  • error / end

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 1.1.1: Published to NPM on 2013-05-31.
    • Set the maxConcurrency config default value to 0 ("unlimited"). Also updated a little code so that a maxConcurrency config value of 0 or less will result in "unlimited", i.e. process the whole array of globbed files at once.
  • 1.1.0: Published to NPM on 2013-05-31.
    • Added the maxConcurrency config options to throttle how many files can be processed simultaneously. This helps avoid issues across the board as most systems have an implicit number of file handles that can be opened as once. It also provides those running on hardware with limited resources to maintain better control of consumption.
    • Under the covers: swapped in the async module to replace q, particularly for its parallelLimit function.
  • 1.0.2: Published to NPM on 2013-05-25.
    • Now omitting directories from the glob results as trying to convert their non-existent line endings throws errors.
  • 1.0.1: Published to NPM on 2013-05-01.
    • Converted 1 stray console.error call to an event emission as intended.
  • 1.0.0: Published to NPM on 2013-05-01.
    • Completely remade: redid the whole API to be an EventEmitter, gutted the implementation, etc.
  • 0.3.0: Published to NPM on 2013-04-03.
    • Hardened the unit tests, which led to exposing and fixing a critical bug in the dos2unix conversion implementation.
  • 0.2.2: Published to NPM on 2013-04-02.
    • Changed tests to write to the OS tmpdir instead of local to the repo, hopefully this fixes the Travis-CI build.
    • Also patched a globbing issue where all paths were relative to the CWD even if the glob command was executed relative to a different directory.
  • 0.2.1: Published to NPM on 2013-04-02.
    • README fixes.
  • 0.2.0: Published to NPM on 2013-04-02.
    • Initial release.

License

Copyright (c) 2013 James M. Greene
Licensed under the MIT license.