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:
24
node_modules/strip-bom/index.js
generated
vendored
Normal file
24
node_modules/strip-bom/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
var isUtf8 = require('is-utf8');
|
||||
|
||||
var stripBom = module.exports = function (arg) {
|
||||
if (typeof arg === 'string') {
|
||||
return arg.replace(/^\ufeff/g, '');
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(arg) && isUtf8(arg) &&
|
||||
arg[0] === 0xef && arg[1] === 0xbb && arg[2] === 0xbf) {
|
||||
return arg.slice(3);
|
||||
}
|
||||
|
||||
return arg;
|
||||
};
|
||||
|
||||
stripBom.stream = function () {
|
||||
var firstChunk = require('first-chunk-stream');
|
||||
|
||||
return firstChunk({minSize: 3}, function (chunk, enc, cb) {
|
||||
this.push(stripBom(chunk));
|
||||
cb();
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user