Skip to content

lt.files

lt.files works with the configured storage backend (S3, MinIO or the local filesystem): list by prefix, read metadata, create signed links and delete.

const result = await lt.files.browse({
prefix: 'screenshots/acme/',
pageSize: 100,
});

List files and directories under a prefix.

Parameters

Field Type Required Description
prefix string No Directory prefix to list
pageSize number No Max results (default 100)
continuationToken string No Pagination token from a previous call

Returns: LTApiResult<{ files: FileEntry[], directories: string[], nextToken?: string }>

const result = await lt.files.getMetadata({ filePath: 'screenshots/page.png' });

Get metadata for one file. When the backend reports a generic content type, the type is inferred from the file extension.

Parameters

Field Type Required Description
filePath string Yes Path to the file

Returns: LTApiResult<{ path, size, modified_at, content_type }>

const result = await lt.files.delete({ filePath: 'screenshots/page.png' });

Permanently delete a file from storage.

Parameters

Field Type Required Description
filePath string Yes Path to the file

Returns: LTApiResult<{ deleted, path }>

const result = await lt.files.generateSignedUrl({
filePath: 'screenshots/page.png',
expiresIn: 3600,
});

Create a time-limited signed URL for sharing a file.

Parameters

Field Type Required Description
filePath string Yes Path to the file
expiresIn number Yes Expiry in seconds: 3600, 21600, 86400, 604800 or 2592000

Returns: LTApiResult<{ url, expiresAt }>. 400 for any other expiresIn.