Permalink
Browse files

Rename sample dir to samples; Fix readme sample syntax

  • Loading branch information...
1 parent 56b1248 commit e9767af290a3ebcd1534ea91167d56aa0df48c57 @wdavidw committed Sep 26, 2010
View
@@ -27,7 +27,11 @@ Using the library is a 4 steps process:
3. Transform the data (optional)
4. Listen to events (optional)
+Here is a exemple:
+
+ // node samples/sample.js
var csv = require('csv');
+
csv()
.fromPath(__dirname+'/sample.in')
.toPath(__dirname+'/sample.out')
@@ -39,11 +43,16 @@ Using the library is a 4 steps process:
console.log('#'+index+' '+JSON.stringify(data));
})
.on('end',function(count){
- console.log('Number of lines '+count);
+ console.log('Number of lines: '+count);
})
.on('error',function(error){
console.log(error.message);
});
+
+ // Print sth like:
+ // #0 ["2000-01-01","20322051544","1979.0","8.8017226E7","ABC","45"]
+ // #1 ["2050-11-27","28392898392","1974.0","8.8392926E7","DEF","23"]
+ // Number of lines: 2
Installing
----------
@@ -134,7 +143,7 @@ When the returned value is an array, the fields are merge in order. When the ret
Exemple of transform returning a string
- // node sample/transform.js
+ // node samples/transform.js
var csv = require('csv');
csv()
@@ -173,7 +182,7 @@ You can define a different order and even different columns in the read options
When working with fields, the `transform` method and the `data` events recieve their `data` parameter as an object instead of an array where the keys are the field names.
- // node sample/column.js
+ // node samples/column.js
var csv = require('csv');
csv()
File renamed without changes.
@@ -1,7 +1,7 @@
// CSV sample - Copyright David Worms <open@adaltas.com> (MIT Licensed)
- // node sample/column.js
+ // node samples/column.js
var csv = require('csv');
csv()
File renamed without changes.
@@ -1,7 +1,7 @@
// CSV sample - Copyright David Worms <open@adaltas.com> (MIT Licensed)
- // node sample/sample.js
+ // node samples/sample.js
var csv = require('csv');
csv()
@@ -15,8 +15,13 @@
console.log('#'+index+' '+JSON.stringify(data));
})
.on('end',function(count){
- console.log('Number of lines '+count);
+ console.log('Number of lines: '+count);
})
.on('error',function(error){
console.log(error.message);
});
+
+ // Print sth like:
+ // #0 ["2000-01-01","20322051544","1979.0","8.8017226E7","ABC","45"]
+ // #1 ["2050-11-27","28392898392","1974.0","8.8392926E7","DEF","23"]
+ // Number of lines: 2
View
@@ -0,0 +1,2 @@
+2000-01-01,20322051544,1979.0,8.8017226E7,ABC,45
+2050-11-27,28392898392,1974.0,8.8392926E7,DEF,23
File renamed without changes.
@@ -1,7 +1,7 @@
// CSV sample - Copyright David Worms <open@adaltas.com> (MIT Licensed)
- // node sample/transform.js
+ // node samples/transform.js
var csv = require('csv');
csv()

0 comments on commit e9767af

Please sign in to comment.