Created
February 19, 2018 15:14
-
-
Save Zulcom/8e3abfa6f2cda6e4b69704ec4957d659 to your computer and use it in GitHub Desktop.
Node.js конвертирование всех файлов в каталоге из кодировки 866 в кодировку UTF-8(BOM)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node.js конвертирование всех файлов в каталоге из кодировки 866 в кодировку UTF-8(BOM) | |
// Node.js convert all files in directory from 866 codepage to UTF-8 (BOM) | |
var fs = require('fs'); | |
var cptable = require('codepage'); | |
fs.readdir('jav/', function (err, filenames) { | |
filenames.forEach(function (filename) { | |
fs.readFile('jav/' + filename, null, function (err, content) { | |
fs.appendFile("jav-utf/" + filename, cptable.utils.decode(866, content), function (err) { | |
console.log(filename); | |
}); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Zulcom file converter", | |
"version": "1.0.0", | |
"description": "Node.js convert 866 codepage to UTF-8 (BOM)", | |
"main": "encoding.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": { | |
"name": "Semon Muravyov", | |
"url": "https://github.com/Zulcom/" | |
}, | |
"license": "MIT", | |
"dependencies": { | |
"codepage": "^1.12.0", | |
"encoding": "^0.1.12" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment