@@ -10,33 +10,31 @@ Read many files with node
1010# How to use?
1111
1212``` js
13- var files = require (' files-io' );
13+ const files = require (' files-io' );
1414
15- files .read ([' README.md' , ' package.json' ], ' utf8' , function (error , allData ) {
15+ files .read ([' README.md' , ' package.json' ], ' utf8' , (error , allData ) => {
1616 console .log (error, allData);
1717});
1818
1919
2020/* Easy way to create pipe which would handle all error events and redirect tham to callback. */
21- var NameFrom = ' README.md' ,
22- NameTo = ' README_COPY.gz' ,
21+ const NameFrom = ' README.md' ;
22+ const NameTo = ' README_COPY.gz' ;
2323
24- options = {
25- gzip: true
26- };
24+ const options = {
25+ gzip: true
26+ };
2727
28- files .pipe (NameFrom, NameTo, options, function (error ) {
29- var msg = ' done' ;
30-
31- console .log (error || msg);
28+ files .pipe (NameFrom, NameTo, options, (error ) => {
29+ console .log (error || ' done' );
3230});
3331
3432/* join couple files and save them to new file with streams */
35- var fs = require (' fs' ),
36- NAME = ' Join' ,
37- writeStream = fs .createWriteStream (NAME );
33+ const fs = require (' fs' );
34+ const NAME = ' Join' ;
35+ const writeStream = fs .createWriteStream (NAME );
3836
39- files .readPipe ([' README.md' , ' package.json' ], writeStream, function (error ) {
37+ files .readPipe ([' README.md' , ' package.json' ], writeStream, (error ) => {
4038 if (error)
4139 console .log (error .message );
4240});
@@ -45,3 +43,4 @@ files.readPipe(['README.md', 'package.json'], writeStream, function(error) {
4543# License
4644
4745MIT
46+
0 commit comments