- Notifications
You must be signed in to change notification settings - Fork0
tagbug/ps-dos2unix
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Smart line ending converter with advanced encoding support for PowerShell
English |中文文档
- 🎯 Smart encoding detection (BOM-aware)
- 📁 Recursive directory processing
- ⚡ Automatic .gitignore integration (requires Git)
- 🛡️ Binary file protection mechanism
- 🔄 On-the-fly encoding conversion (UTF-8/16/32)
- 📏 Configurable file size limit (default 1MB)
- 📝 File type whitelist/blacklist system
irm https://raw.githubusercontent.com/tagbug/ps-dos2unix/main/install/install.ps1| iex
# 1. Clone the repositorygit clone https://github.com/tagbug/ps-dos2unix.git# 2. Create user module directory$documentsPath= [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)$userModulePath=Join-Path$documentsPath"WindowsPowerShell\Modules\dos2unix"New-Item-Path$userModulePath-ItemType Directory-Force# 3. Copy module filesCopy-Item ./ps-dos2unix/src/*$userModulePath-Recurse# 4. Verify installationImport-Module dos2unix-Forcedos2unix-Help
⚠Note: If you encounter installation issues, try switching the line ending of the source code to CRLF.
Uninstall for quick install:
irm https://raw.githubusercontent.com/tagbug/ps-dos2unix/main/install/uninstall.ps1| iex
Uninstall for manual install:
# 1. Remove module directory$documentsPath= [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)$userModulePath=Join-Path$documentsPath"WindowsPowerShell\Modules\dos2unix"Remove-Item$userModulePath-Recurse-Force# 2. Clean up environment variables$newPath= ($env:PSModulePath-split';'|Where-Object {$_-notmatch"dos2unix" })-join';'[Environment]::SetEnvironmentVariable("PSModulePath",$newPath,"User")# 3. Remove cloned repository (optional)Remove-Item ./dos2unix-Recurse-Force
Basic Conversion:
# Convert current directorydos2unix# Specify path with verbose outputdos2unix-Path D:\Projects-Verbose
Advanced Usage:
# Convert with encoding to UTF-8dos2unix-Path ./src-ConvertEncoding-TargetEncoding utf-8# Exclude directoriesdos2unix-Exclude node_modules,bin# Process large filesdos2unix-MaxFileSize10MB# Custom file filteringdos2unix-WhiteList"cs,json"-BlackList"exe,dll"
Parameter | Description | Default |
---|---|---|
-Path | Target directory path | Current directory |
-Exclude | Directories to exclude | node_modules, dist, .git |
-Encoding | Force specific encoding | Auto-detect |
-WhiteList | Allowed file extensions | Common text formats |
-BlackList | Blocked file extensions | Common binary formats |
-MaxFileSize | Max file size (supports KB/MB/GB) | 1MB |
-ConvertEncoding | Enable encoding conversion | $false |
-TargetEncoding | Target encoding format | utf-8 |
Q: File encoding issues after conversion?→Backup files before processing!→ Try specifying encoding format:-Encoding utf8
→ Check original file encoding:Get-Content -Encoding Byte -TotalCount 3
Q: Slow processing speed?→ Add excluded directories:-Exclude node_modules
→ Adjust file size limit:-MaxFileSize 500KB
This project is licensed under theMIT License
About
dos2unix for powershell
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published