mirror of
https://github.com/Raghu-Ch/nodeRestAPI.git
synced 2026-02-10 20:53:02 -05:00
initial commit
This commit is contained in:
42
node_modules/strip-bom/cli.js
generated
vendored
Normal file
42
node_modules/strip-bom/cli.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var pkg = require('./package.json');
|
||||
var stripBom = require('./');
|
||||
var argv = process.argv.slice(2);
|
||||
var input = argv[0];
|
||||
|
||||
function help() {
|
||||
console.log([
|
||||
'',
|
||||
' ' + pkg.description,
|
||||
'',
|
||||
' Usage',
|
||||
' strip-bom <file> > <new-file>',
|
||||
' cat <file> | strip-bom > <new-file>',
|
||||
'',
|
||||
' Example',
|
||||
' strip-bom unicorn.txt > unicorn-without-bom.txt'
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
if (argv.indexOf('--help') !== -1) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
if (argv.indexOf('--version') !== -1) {
|
||||
console.log(pkg.version);
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.stdin.isTTY) {
|
||||
if (!input) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
fs.createReadStream(input).pipe(stripBom.stream()).pipe(process.stdout);
|
||||
} else {
|
||||
process.stdin.pipe(stripBom.stream()).pipe(process.stdout);
|
||||
}
|
||||
Reference in New Issue
Block a user