forked from z00m128/zmakebas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (25 loc) · 726 Bytes
/
index.js
File metadata and controls
29 lines (25 loc) · 726 Bytes
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
const Module = require('./dist/zmakebas.js')
module.exports = (input, labelsMode) => {
// Prepare args for the zmakebas command.
const args = [];
args.push('-a');
args.push('0');
if (labelsMode) args.push('-l');
args.push('-o');
args.push('output.tap');
args.push('input.bas');
// Collect output.
const out = [];
// Call the zmakebas module with data for command.
return new Promise((resolve, reject) => {
Module({
arguments: args,
input,
out,
resolve,
reject,
print: (text) => out.push({type: 'out', text}),
printErr: (text) => out.push({type: 'err', text}),
});
});
}