-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (53 loc) · 1.67 KB
/
index.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
var FileInput = require('./lib/fileinput').FileInput;
exports.FileInput = FileInput;
exports.DEFAULT_BUFSIZE = 8*1024;
var instance = null;
exports.input = function input(files, bufsize, flags) {
if(instance != null) {
throw new Error('.input() already active, create an normal FileInput instance instead.');
}
instance = new FileInput(files, bufsize, flags);
return instance;
};
exports.readline = function readline(callback) {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.readline(callback);
};
exports.filename = function filename() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.filename();
};
exports.fileno = function fileno() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.fileno();
};
exports.lineno = function lineno() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.lineno();
};
exports.filelineno = function filelineno() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.filelineno();
};
exports.isfirstline = function isfirstline() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.isfirstline();
};
exports.isstdin = function isstdin() {
if(instance == null) {
throw new Error('no active .input() found, call `fileinput.input()` first.');
}
return instance.isstdin();
};