Generate a File's Link

The Assets provider allows you to generate a link to a file that is publicly accessible. You can optionally provide a duration for the link, otherwise the default value of 5 minutes will be used. The duration for a link is specified with a number followed by a unit, so for 5 minutes you will use, 5m. Seconds (s), hours (h), minutes (m), days (d), and weeks (w) are supported.

Method signature

generateLink(filePath: string, duration?: string)

Generating a File's Link

const session = vcr.createSession();
const assets = new Assets(session);

const fileData = await assets.generateLink('/imgs/image.png', '5m');