Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

encoding-checker

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encoding-checker - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

28

.bin/index.js

@@ -33,7 +33,13 @@ #!/usr/bin/env node

nodir: true,
dot: true
dot: true,
ignore: [
".git/**",
"node_modules/**",
]
};
glob(argv.pattern, options)
.then((files) => {
async function bootstrap() {
try {
const files = await glob(argv.pattern, options);
if (argv.verbose) {

@@ -43,14 +49,18 @@ console.log(`Found items: ${files.length}`.gray);

EncodingChecker.verify(argv['ignore-encoding'], files, ({ encoding, file, error }) => {
const status = await EncodingChecker.verify(argv['ignore-encoding'], files);
status.forEach(({ encoding, file, error }) => {
if (error) {
const message = error.message || 'unexpected error';
console.error(message.red);
return;
} else {
console.log('[%s] %s', encoding, file && file.blue);
}
console.log('[%s] %s', encoding, file && file.blue);
});
})
.catch((err) => {
} catch (err) {
const message = err.message;
console.error(message.red);
});
}
}
bootstrap().catch((err) => console.error(err));
{
"name": "encoding-checker",
"description": "Tool to investigate files with different encoding than passed",
"version": "1.1.5",
"version": "1.1.6",
"license": "MIT",

@@ -27,3 +27,2 @@ "author": {

"jschardet": "^1.6.0",
"sequence-as-promise": "^1.2.0",
"yargs": "^12.0.2"

@@ -30,0 +29,0 @@ },

'use strict';
const sequence = require('sequence-as-promise');
const jschardet = require('jschardet');

@@ -33,10 +32,13 @@ const fs = require('fs');

function verifyCharsetFileList(ignoreEncoding, matches, iteratee = (args) => args) {
async function verifyCharsetFileList(ignoreEncoding, matches) {
const files = matches.filter(isFile);
return sequence(files.map((file) => () => fetchCharset(file)
.then((charset) => {
if (ignoreEncoding === charset.encoding) return;
return iteratee(charset);
})
));
const charset = await Promise.all(
files.map(fetchCharset)
);
return charset
.filter(({ encoding }) => {
return (encoding !== ignoreEncoding);
});
}

@@ -43,0 +45,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc