aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/FS.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/PursLoader/FS.js')
-rw-r--r--src/PursLoader/FS.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/PursLoader/FS.js b/src/PursLoader/FS.js
deleted file mode 100644
index 1a7f5b0..0000000
--- a/src/PursLoader/FS.js
+++ /dev/null
@@ -1,36 +0,0 @@
1'use strict';
2
3// module PursLoader.FS
4
5var fs = require('fs');
6
7var async = require('async');
8
9function writeFileUtf8Fn(filepath, contents, errback, callback) {
10 return function(){
11 fs.writeFile(filepath, contents, function(error){
12 if (error) errback(error)();
13 else callback()();
14 });
15 };
16}
17
18function findFileUtf8Fn(nothing, just, regex, filepaths, errback, callback) {
19 return function(){
20 function findFile(filepath, callback) {
21 fs.readFile(filepath, {encoding: 'utf-8'}, function(error, result){
22 if (error) callback(false);
23 else callback(regex.test(result));
24 });
25 }
26
27 async.detect(filepaths, findFile, function(result){
28 if (!result) callback(nothing)();
29 else callback(just(result))();
30 });
31 };
32}
33
34exports.writeFileUtf8Fn = writeFileUtf8Fn;
35
36exports.findFileUtf8Fn = findFileUtf8Fn;