import Casedev from 'casedev';
const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });
// Submit your user's document for processing
const job = await client.ocr.v1.process({
document_url: uploadedDocumentUrl
});
// Poll for completion
let result = await client.ocr.v1.retrieve(job.id);
while (result.status === 'pending' || result.status === 'processing') {
await new Promise(r => setTimeout(r, 2000));
result = await client.ocr.v1.retrieve(job.id);
}
// Return extracted text to your user
const text = await client.ocr.v1.download(job.id, 'text');
console.log(text);