Permalink
Browse files

change interface to a single function

  • Loading branch information...
wayfind committed Sep 12, 2012
1 parent c40a2bd commit 61a35e0bc05d7d152291ec4a4a1395ffbf6d96f8
Showing with 35 additions and 2 deletions.
  1. +12 −0 README.md
  2. +7 −0 ansi.txt
  3. +1 −1 is-utf8.js
  4. +1 −1 package.json
  5. +7 −0 test.js
  6. +7 −0 utf8.txt
View
@@ -0,0 +1,12 @@
+#utf8 detector
+
+Detect if a Buffer is utf8 encoded
+
+ var fs = require('fs');
+ var isUtf8 = require('is-utf8');
+ var ansi = fs.readFileSync('ansi.txt');
+ var utf8 = fs.readFileSync('utf8.txt');
+
+ console.log('ansi.txt is utf8: '+isUtf8(ansi));
+ console.log('utf8.txt is utf8: '+isUtf8(utf8));
+
View
@@ -0,0 +1,7 @@
+zheasdf
+�����ܰ����ѹ������ �����ɹ���޳�����(ͼ��)
+ͼ��:�������ɵ�½��˽�� ١���Ϊ��ӥ�ڼٳ���Ǹ
+������Ĭ�����������:����������� ������̸����̬�ȷ���
+ͼ�����ձ�����ͯ��Ů��Ӿװд�� ���ƹ�ѹ������
+ͼ����Holdס���̶����� ����Ĭ���븻�����ѷ���
+ͼ��������Ƭ��ӳŮ�ǵ������� �������������������
View
@@ -1,5 +1,5 @@
-exports.isUtf8 = function(bytes)
+exports = module.exports = function(bytes)
{
var i = 0;
while(i < bytes.length)
View
@@ -4,7 +4,7 @@
"description": "detect if a buffer is utf8 encoded.",
"main": "is-utf8.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "node test.js"
},
"repository": "https://github.com/wayfind/is-utf8.git",
"keywords": [
View
@@ -0,0 +1,7 @@
+var fs = require('fs');
+var isUtf8 = require('./is-utf8.js');
+var ansi = fs.readFileSync('ansi.txt');
+var utf8 = fs.readFileSync('utf8.txt');
+
+console.log('ansi.txt is utf8: '+isUtf8(ansi));
+console.log('utf8.txt is utf8: '+isUtf8(utf8));
View
@@ -0,0 +1,7 @@
+asdfasdaaf
+传李晨张馨予因压力大分手 侯佩岑晒夫妻出游照(图集)
+图集:刘亦菲与干爹陈金飞私照 佟丽娅为金鹰节假唱致歉
+章子怡默认与撒贝宁恋情:心里有数就行 刘恺威谈婚期态度反复
+图集:日本巨乳童颜女星泳装写真 隋唐裹床单压轴走秀
+图集:Hold住姐翘二郎腿 蔡琴默认与富商男友分手
+图集:港三级片首映女星低胸亮相 李嘉欣自曝无意再造人

0 comments on commit 61a35e0

Please sign in to comment.