Skip to content

Commit

Permalink
Make documentation clearer on raw file content input
Browse files Browse the repository at this point in the history
See #30
  • Loading branch information
Nixinova committed Mar 8, 2024
1 parent 22de525 commit 229d324
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,17 @@ Running LinguistJS on this folder will return the following JSON:

```js
const linguist = require('linguist-js');
let folder = './src';
let options = { keepVendored: false, quick: false };
const { files, languages, unknown } = linguist(folder, options);

// Analyse folder on disc
const folder = './src';
const options = { keepVendored: false, quick: false };
const { files, languages, unknown } = await linguist(folder, options);

// Analyse file content from raw input
const fileNames = ['file1.ts', 'file2.ts', 'ignoreme.js'];
const fileContent = ['#!/usr/bin/env node', 'console.log("Example");', '"ignored"'];
const options = { ignoredFiles: ['ignore*'] };
const { files, languages, unknown } = await linguist(fileNames, { fileContent, ...options });
```

- `linguist(entry?, opts?)` (default export):
Expand All @@ -122,7 +130,7 @@ const { files, languages, unknown } = linguist(folder, options);
Alias for `checkAttributes:false, checkIgnored:false, checkHeuristics:false, checkShebang:false, checkModeline:false`.
- `offline` (boolean):
Whether to use pre-packaged metadata files instead of fetching them from GitHub at runtime (defaults to `false`).
- `keepVendored` (boolean):
- `keepVendored` (boolean):
Whether to keep vendored files (dependencies, etc) (defaults to `false`).
Does nothing when `fileContent` is set.
- `keepBinary` (boolean):
Expand Down

0 comments on commit 229d324

Please sign in to comment.