JavaScript SDK (v0.48.0)Guides
Files
A guide on how to work with files using the WriftAI JavaScript client
This section demonstrates common file operations you can perform with the WriftAI JavaScript client. These examples are not exhaustive — check the client reference for all options.
Generate file URLs
This is a low-level method. It returns a pair of URLs for uploading and downloading a file:
const urls = await wriftai.files.createUrls({
name: 'scan.pdf',
size: 102400,
resource: 'prediction',
mime_type: 'application/pdf',
});
urls.upload_url; // PUT your file contents here
urls.download_url; // use this to retrieve the file later