Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Language detection for Javascript. Based on the CLD2 (Compact Language Detector) library from Google. Highly optimized for space and speed. Runs about 10x faster than other libraries. Detects over 160 languages. Full test coverage. Runs on Linux, OS X, an
Language detection for Javascript. Based on the CLD2 (Compact Language Detector) library from Google.
Highly optimized for space and speed. Runs about 10x faster than other libraries. Detects over 160 languages. Full test coverage. Runs on Linux, OS X, and Windows.
$ npm install cld
Linux users, make sure you have g++ >= 4.8. If this is not an option, you should be able to install node-cld 2.4.4 even with an older g++ build.
const cld = require('cld');
// As a promise
cld.detect('This is a language recognition example').then((result) => {
console.log(result);
});
// In an async function
async function testCld() {
const result = await cld.detect('This is a language recognition example');
console.log(result);
}
const cld = require('cld');
const text = 'Това е пример за разпознаване на Български език';
const options = {
isHTML : false,
languageHint : 'BULGARIAN',
encodingHint : 'ISO_8859_5',
tldHint : 'bg',
httpHint : 'bg'
};
// As a promise
cld.detect(text, options).then((result) => {
console.log(result);
});
// In an async function
async function testCld() {
const result = await cld.detect(text, options);
console.log(result);
}
Detect can be called leveraging the node callback pattern. If options are provided, the third parameter should be the callback.
const cld = require('cld');
cld.detect('This is a language recognition example', (err, result) => {
console.log(result);
});
Set to true if the string contains HTML tags
Pass a LANGUAGES key or value as a hint
Pass an ENCODINGS value as a hint
Pass top level domain as a hint
Pass an HTTP "Content-Encoding" value as a hint
Set to true to give best-effort answer, instead of UNKNOWN_LANGUAGE. May be useful for short text if the caller prefers an approximate answer over none.
Once the module has been installed, the underlying C sources will remain in the deps/cld
folder and continue to occupy considerable space. This is because they will be required if you ever need to run npm rebuild
. If you are under severe constraints you can delete this folder and reclam >100M
Copyright 2011-2015, Blagovest Dachev.
Apache 2
FAQs
Language detection for Javascript. Based on the CLD2 (Compact Language Detector) library from Google. Highly optimized for space and speed. Runs about 10x faster than other libraries. Detects over 160 languages. Full test coverage. Runs on Linux, OS X, an
The npm package cld receives a total of 11,292 weekly downloads. As such, cld popularity was classified as popular.
We found that cld demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.