Registry / data / franc-cli

franc-cli

JSON →
library8.0.0jsnpmunverified

franc-cli is a command-line interface (CLI) tool for detecting the natural language of textual input. It acts as a convenient shell wrapper around the core `franc` library, which supports identifying over 180 languages, including various scripts and dialects. The current stable version for `franc-cli` is 8.0.0, which corresponds to breaking changes introduced in `franc` library versions 6.x.x. The project generally follows the `franc` library's release cadence, with updates often driven by new Unicode versions or improvements in language detection models. Its key differentiator is providing quick, direct command-line access to language detection without requiring programmatic integration, making it suitable for shell scripting, data processing pipelines, and rapid prototyping. It is an ESM-only package, requiring Node.js version 12 or higher for execution.

data
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The `franc-cli` package is a command-line tool. For programmatic language detection within JavaScript/TypeScript applications, you should install and import from the `franc` library package. This library is ESM-only since v6.

import { franc } from 'franc'

This function, from the `franc` library, was renamed from `franc.all` to `francAll` in `franc` v6. It is also ESM-only, requiring a native ES module import.

import { francAll } from 'franc'

The `franc` library, which `franc-cli` uses under the hood, became ESM-only in version 6.0.0. Attempting to `require()` it will result in a runtime error (`ERR_REQUIRE_ESM`).

N/A

This quickstart demonstrates how to programmatically execute the `franc-cli` command-line tool from a Node.js script using `child_process` and capture its output to detect the language of a given text string.

import { spawn } from 'child_process'; const textToAnalyze = "Alle menslike wesens word vry en gelyk in waardigheid en regte gebore."; const child = spawn('franc-cli', [textToAnalyze]); let output = ''; child.stdout.on('data', (data) => { output += data.toString(); }); child.stderr.on('data', (data) => { console.error(`stderr: ${data}`); }); child.on('close', (code) => { if (code === 0) { console.log(`Detected language: ${output.trim()}`); } else { console.error(`franc-cli exited with code ${code}`); } });
franc --version
Debug
Known footguns
breakingThe `franc` library, on which `franc-cli` is based, transitioned to an ESM-only package in version 6.0.0. Consequently, `franc-cli@8.0.0` and newer are also ESM-only. This means `require()` statements are no longer supported, and Node.js 12+ is required.
breakingThe `franc` library's `franc.all()` method was renamed to `francAll()` in version 6.0.0 for better ESM compatibility and adherence to naming conventions.
gotcha`franc-cli` is a command-line interface tool. It is not designed to be imported directly into JavaScript/TypeScript code as a library. For programmatic language detection, you should install and use the `franc` library package.
gotchaThe version numbers of `franc-cli` do not directly correlate with the `franc` library versions. For example, `franc-cli@8.0.0` is built upon `franc@6.x.x`. Always consult the monorepo's changelog for specific version dependencies and breaking changes affecting the underlying library.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources