Document and Nodes
llamaindex readers is a collection of readers for different file formats.
We offer readers for different file formats.
SimpleDirectoryReader
SimpleDirectoryReader
is the simplest way to load data from local files into LlamaIndex.
Tips when using in non-Node.js environments
When using @llamaindex/readers
in a non-Node.js environment (such as Vercel Edge, Cloudflare Workers, etc.)
Some classes are not exported from top-level entry file.
The reason is that some classes are only compatible with Node.js runtime, (e.g. PDFReader
) which uses Node.js specific APIs (like fs
, child_process
, crypto
).
If you need any of those classes, you have to import them instead directly through their file path in the package.
As the PDFReader
is not working with the Edge runtime, here's how to use the SimpleDirectoryReader
with the LlamaParseReader
to load PDFs:
Note: Reader classes have to be added explicitly to the
fileExtToReader
map in the Edge version of theSimpleDirectoryReader
.
You'll find a complete example with LlamaIndexTS here: https://github.com/run-llama/create_llama_projects/tree/main/nextjs-edge-llamaparse
Load file natively using Node.js Customization Hooks
We have a helper utility to allow you to import a file in Node.js script.
Last updated on