domoritz commented on code in PR #39081:
URL: https://github.com/apache/arrow/pull/39081#discussion_r1425882652
##########
http/examples/get/client.js:
##########
@@ -0,0 +1,25 @@
+const Arrow = require('apache-arrow');
+
+const url = 'http://localhost:8000';
+
+async function getArrowData(url) {
+ try {
+ const table = await Arrow.tableFromIPC(fetch(url))
+ return table;
+ } catch (error) {
+ console.error('Error:', error.message);
+ }
+}
+
+const startTime = new Date();
+
+getArrowData(url)
+ .then(table => {
+ const endTime = new Date();
+ const duration = (endTime - startTime) / 1000;
+ console.log(`${table.batches.length} record batches received`);
+ console.log(`${duration.toFixed(2)} seconds elapsed`);
+ })
+ .catch(error => {
+ console.error('Error:', error.message);
+ });
Review Comment:
I'd suggest using more modern async here as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]