Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
dos2unix
Advanced tools
Readme
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.
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/*']);
// 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);
start
processing.start
processing.skip
convert.start
convert.error
/ convert.end
processing.error
/ processing.end
error
/ end
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.
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.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.async
module to replace q
, particularly for its
parallelLimit
function.console.error
call to an event emission as intended.dos2unix
conversion implementation.glob
command was executed relative to a different directory.Copyright (c) 2013 James M. Greene
Licensed under the MIT license.
FAQs
A Node.js module to convert text files with DOS line breaks to Unix line breaks, i.e. like using `dos2unix`.
The npm package dos2unix receives a total of 138 weekly downloads. As such, dos2unix popularity was classified as not popular.
We found that dos2unix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.