jgo
v0.1.0
Published
JavaScript on the server, the Go-way
Downloads
13
Readme
jgo
JavaScript on the server, the Go-way
Examples
File IO
const fs = require("jgo/fs");
const csv = require("jgo/csv");
async function processCSV() {
const inFile = await fs.open("input.csv");
const inCSV = csv.reader(inFile);
const outFile = await fs.create("output.csv");
const outCSV = csv.writer(outFile);
//read until EOF
while(const row = await inFile.read()) {
//process row
row[1] = "my new text";
//write each row as we read
outfile.write(row);
}
inFile.close();
outFile.close();
}
Concurrency
Outer async, resolve exits with 0, rejects with 1
const go = require("jgo");
//mirrors go-main
go.main(async () => {
const list = [1, 2, 3];
await go.map(list, n => n * 3);
go.logf(list);
});
Concurrency
//TODO
Interfaces
//TODO typescript