file-encoder

0.0.20150925 • Public • Published

file-encoder

file-encoder is a script that uses libicu to detect file encoding & uses iconv to convert files' encoding.

you DO NOT have to know the original encoding of the file to finish the converting

Usage

NOTE: install iconv & ICU first if you haven't.

npm install file-encoder -g
file-encoder -h
  • use case: convert a file's encoding to utf8
file-encoder -f ${filename}
  • use case: convert a file's content to utf8 and write to another file
file-encoder -f ${filename} -t ${targetFilename}
  • use case: convert all files' encoding to gbk in a directory
file-encoder -d ${directory} -e gbk
  • use case: convert all files' encoding to utf8 in a directory recursively
file-encoder -d ${directory} -r
  • use case: convert all files' encoding to utf8 in a directory recursively excluding some paths
file-encoder -d ${directory} -r --exclude node_modules --exclude test --exclude dev
  • use case: convert encoding of all files with specified extnames to utf8 in a directory
file-encoder -d ${directory} --extname js --extname css --extname html

Thanks to

file-encoder is made possible by all these fantastic projects:

Package Sidebar

Install

npm i file-encoder

Weekly Downloads

5

Version

0.0.20150925

License

none

Last publish

Collaborators

  • leungwensen