Last active
June 13, 2016 09:50
-
-
Save dsheiko/3248342d16adfd952e060907d2bc4c49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* getStocksStream() { | |
var reader = new AsyncFileReader(“stocks.txt”); | |
try { | |
while(!reader.eof) { | |
var line = await reader.readLine(); | |
await yield JSON.parse(line); | |
} | |
} | |
finally { | |
await reader.close(); | |
} | |
} | |
(async function() { | |
for (let line on getStocksStream()) { | |
console.log( line ); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment