Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign in
Socket

text-encode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-encode - npm Package Compare versions

Comparing version
1.0.2
to
1.0.3
+4
test.js
var TextEncode = require('.')
new TextEncode().readTextAsync('D:/svn.txt', function(err, text){
console.log(text)
});
+2
-2
{
"name": "text-encode",
"version": "1.0.2",
"version": "1.0.3",
"description": "自动识别文本文件的编码及BOM处理,读取实际文件内容,并支持以相同格式保存回去",
"main": "textEncode.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test.js"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -17,6 +17,14 @@ var iconv = require('iconv-lite');

},
readTextAsync: function (fileName, cb) {
var it = this;
fs.readFile(fileName, function (err, bytes) {
cb(err, it.readBytes(bytes))
});
},
readText: function (fileName) {
var bytes = fs.readFileSync(fileName);
return this.readBytes(bytes);
},
readBytes: function (bytes) {
var encoding = null;
var bytes = fs.readFileSync(fileName);
var bomLen = 0;

@@ -112,1 +120,3 @@ if (bytes.length > 1) {

}
module.exports = TextEncode