Investigates data to determine what the textual characteristics are.
The ratios are still fairly arbirtrary, and will need more sample/test data to mature. In addition, it may skew anglocentric in assuming primarily US-ASCII characters when determining encoding based on byte value frequency.
To install: Install-Module Detextive
Using the editorconfig library to support editorconfig settings.
Documentation is automatically generated using platyPS (.\doc.cmd
).
- Add-Utf8Signature — Adds the utf-8 signature (BOM) to a file.
- Get-FileContentsInfo — Returns whether the file is binary or text, and what encoding, line endings, and indents text files contain.
- Get-FileEditorConfig — Looks up the editorconfig values set for a file.
- Get-FileEncoding — Returns the detected encoding of a file.
- Get-FileIndents — Returns details about a file's indentation characters.
- Get-FileLineEndings — Returns details about a file's line endings.
- Remove-Utf8Signature — Removes the utf-8 signature (BOM) from a file.
- Repair-Encoding — Re-encodes commonly mis-encoded text.
- Repair-FileEditorConfig — Corrects a file's editorconfig settings when they differ from the actual formatting found.
- Test-BinaryFile — Returns true if a file does not appear to contain parseable text, and presumably contains binary data.
- Test-BrokenEncoding — Returns true if text contains a nonsense sequence of characters resulting from parsing text with the wrong encoding.
- Test-FileEditorConfig — Validates a file's editorconfig settings against the actual formatting found.
- Test-FinalNewline — Returns true if a file ends with a newline as required by the POSIX standard for text files.
- Test-TextFile — Returns true if a file contains text.
- Test-Utf8Encoding — Returns true if a file is parseable as UTF-8.
- Test-Utf8Signature — Returns true if a file starts with the optional UTF-8 BOM/signature.
Tests are written for Pester (.\test.cmd
).