Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var fs = require("fs");
var Bacon = require("baconjs");
var lifestyle = require("lifestyle");
var root = ""
var adListPath = "adids.txt";
var client = new lifestyle.FinnClient(root);
function fetchAd(id) {
return Bacon.fromPromise(client.getAd(id));
function handleError(err) {
process.stderr.write(err.message + "\n");
function handleSuccess(ad) {
process.stdout.write(JSON.stringify(ad) + "\n");
function getAdIds(path) {
return fs.readFileSync(path, 'utf8').trim().split('\n');
var responses = Bacon
.flatMapWithConcurrencyLimit(6, fetchAd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.