[ 
https://issues.apache.org/jira/browse/ARROW-2686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16506600#comment-16506600
 ] 

Dominik Moritz commented on ARROW-2686:
---------------------------------------

import { Table } from "@apache-arrow/es2015-esm";

fetch(require("../data/flights-10k.arrow")).then(response => {
  response.arrayBuffer().then(buffer => {
    const table = Table.from(new Uint8Array(buffer));
    console.log(table.toString());
  });
});

Works. Feel free to close this or improve the documentation. 

> Cannot load .arrow file in JavaScript
> -------------------------------------
>
>                 Key: ARROW-2686
>                 URL: https://issues.apache.org/jira/browse/ARROW-2686
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: JavaScript
>            Reporter: Dominik Moritz
>            Priority: Major
>
> I'm trying to create load an arrow file in IPC format. 
> First, I load the library
> import { Table } from "@apache-arrow/es2015-esm";
> Then, I fetch the file and convert it to the buffer (it would be nice if this 
> wasn't necessary)
> fetch(require("../data/flights-10k.arrow")).then(response => {
>   response.blob().then(blob => {
>     let arrayBuffer;
>     const fileReader = new FileReader();
>     fileReader.onload = function() {
>       arrayBuffer = this.result;
>       const table = Table.from(arrayBuffer);
>       console.log(table.toString());
>     };
>     fileReader.readAsArrayBuffer(blob);
>   });
> });
> Now I get the error "Uncaught TypeError: Cannot read property 'fields' of 
> undefined"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to