-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhyper-scripts.js
62 lines (62 loc) · 1.58 KB
/
hyper-scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Generated by LiveScript 1.5.0
(function(){
var needle, fs, cheerio, csvjson, STATE, req, defaultValue;
needle = require('needle');
fs = require('fs');
cheerio = require('cheerio');
csvjson = require('csvjson');
global._ = require('underscore');
STATE = {
tmp_file: 'some-file.txt'
};
req = function(p, q){
q == null && (q = 'p');
throw new Error(q + " req " + (p ? 'Type: ' + p : ''));
};
defaultValue = function(p){
return p;
};
global.GET = function(p, q){
needle.get("http://" + p, function(e, r){
if (q) {
return q(r != null ? r.body : void 8);
}
});
};
global.write = function(p, q, r){
q == null && (q = defaultValue(STATE.tmp_file));
return fs.writeFile(q, p, 'utf8', r);
};
global._$ = function(p){
return cheerio.load(p);
};
global.fromPipe = function(p){
var istring;
p == null && (p = req());
istring = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data){
return istring += data;
});
return process.stdin.on('end', function(){
return p(istring);
});
};
global.csvtoj = function(p){
p == null && (p = defaultValue(STATE.tmp_file));
return csvjson.toObject(p).output;
};
global.copy = function(p, q){
var myfile;
p == null && (p = req('String'));
q == null && (q = 'new_copy');
myfile = fs.readFileSync(p);
return fs.writeFile(q, myfile);
};
global._sweb = function(p, q){
return GET(p, function(p2){
return write(p2, '_sweb.html');
});
};
}).call(this);