In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx IO Discussions

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Using JsEvent("GetFileContents") for large files

mkhtran
9 - Comet

It seems that `JsEvent("GetFileContents")` will fail (return an empty string) if it tries to read a file that is too big. Somewhere around 1 MB is the limit.

 

Is there any way around this?

 

Currently I have to chunk my data across multiple files so that the UI can read it with `JsEvent("GetFileContents")`.

 

 

def on_complete(self) -> None:
    chunk_size = 1000000 # This is a good size to prevent GetFileContents from failing
    for index in range(0, len(self.data), chunk_size):
        chunk = data[index:index + chunk_size]
        with open(self.provider.environment.create_temp_file(), "w") as data_file:
            data_file.write(chunk)
void (async () => {
  const chunks = []
  for (const dataFile in dataFiles) {
    chunks.push(await JsEvent('GetFileContents', { Path: dataFile }))
  }
  const data = chunks.join()
})()

 

 

But I also have other files I'd like to read that I cannot simply chunk.

0 REPLIES 0