Docs
Unstructured Loader
Unstructured Loader
With the Unstructured Loader, you can load various types of files and extract their content using the Unstructured API.
Installation
Install peer dependencies:
Add Environment Variables
Copy the code
Add the following code to your utils/unstructuredLoader.ts
file:
Usage
Initialize client
Initialize the UnstructuredLoader client.
Load files from local directory
Provide the local file path to initiate it's content extraction.
Load files directly
Files can also be loaded directly, in this example assuming they are received as FormData.
Props
UnstructuredLoader
Prop | Type | Description | Default |
---|---|---|---|
apiKey | string | The API key for Unstructured.io | "" |
baseUrl | string? | Server URL in case of self-hosting | "" |
loadUnstructuredDirectoryData
Prop | Type | Description |
---|---|---|
filePath | string | The local file path of the file. |
fileName | string | Name of the file. |
returnText | boolean? | If true, the data returned will be a single string. |
options | optional | Additional options as specified in the Unstructured documentation. |
loadUnstructuredFileData
Prop | Type | Description |
---|---|---|
fileContent | Uint8Array | Uint8Array content of the file. |
fileName | string | Name of the file. |
returnText | boolean? | If true, the data returned will be a single string. |
options | optional | Additional options as specified in the Unstructured documentation. |
Credits
This component is built on top of Unstructured Typescript SDK