Skip to main content

Overview

Link to Github https://github.com/LucidtechAI/las-sdk-js

Link to NPM https://www.npmjs.com/package/@lucidtech/las-sdk-node

Installing

Prerequisites: Node and npm

Package includes full Typescript type declarations for all methods and API responses.

npm install @lucidtech/las-sdk-node

Alternatively, using yarn

yarn add @lucidtech/las-sdk-node

Example usage

Using your credentials to create a Client instance, then reading a file and uploading it to Cradl:

import { Client } from '@lucidtech/las-sdk-core';
import { ClientCredentials } from '@lucidtech/las-sdk-node';
import { readFile } from 'fs/promises'


const credentials = new ClientCredentials('<apiEndpoint>', '<clientId>', '<clientSecret>', '<authEndpoint>');
const client = new Client(credentials);
const fileBuffer = await readFile('...path/file.jpg')
const documentResponse = await client.createDocument(fileBuffer, 'image/jpeg');

console.log(documentResponse);
/*
{
"documentId": "<documentId>",
"contentType": "image/jpeg",
"retentionInDays": 1825,
"createdTime": "2021-10-08T09:55:20.489723+0000",
"updatedTime": null,
"createdBy": "<userId>",
"updatedBy": null
}
*/