jgo

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jgo

Weekly Downloads

0

Version

0.1.0

License

none

Unpacked Size

931 B

Total Files

2

Last publish

Collaborators

  • jpillora