When I do a `file.load()` on a file greater than ...
# suitescript
y
When I do a
file.load()
on a file greater than 10MB in size I get an error. I was hoping to at least load a large file and use
File.lines.iterator()
to process it. Is there a way around this Netsuite limitation? My script is of type suitelet.
b
what does your code look like
y
The code where it errors out is simply
const csvFile = file.load(fileId);
and the file was previously generated via
Copy code
const fileId= file.create({
  name: "result.csv",
  fileType: file.Type.CSV,
  folder: dataFolderId,
  isOnline: false,
  encoding: file.Encoding.UTF_8,
  contents: 'BLANK'
}).save();
const searchTask = task.create({
  taskType: task.TaskType.SEARCH,
  savedSearchId: searchId,
  fileId: fileId
});
I run different saved search for the searchId and depending on the saved search the file size changes
b
how big is the file?
y
50MB
b
that sounds reasonable
And your code predictably runs without errors in the debugger
Copy code
require(["N/file"], function (file) {
  const fileId = "10130";
  const csvFile = file.load(fileId);
});
y
I haven't run it through the debugger, but yes the error is predictable when I point the searchId to a saved search with a large result (100,000+ rows of result) and the resulting file, when looking at the File Cabinet, is over 10MB
s
what is the specific error? Maybe it's an issue with the search portion?
y
The search is loaded from existing saved search via ID. Thanks for the help. I did a bit of search and it seems like there is no getting around the 10MB file size limit that Netsuite put in place.