UNPKG

fluro

Version:

Promise based HTTP Fluro client for the browser and node.js

2,146 lines (627 loc) 36.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>asset - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="fluro.html">fluro</a></li><li><a href="fluro.access.html">access</a><ul class='methods'><li data-type='method'><a href="fluro.access.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="fluro.access.html#.can">can</a></li><li data-type='method'><a href="fluro.access.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="fluro.access.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="fluro.access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="fluro.access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="fluro.access.html#.has">has</a></li><li data-type='method'><a href="fluro.access.html#.isAuthor">isAuthor</a></li><li data-type='method'><a href="fluro.access.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="fluro.access.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="fluro.access.html#.retrieveActionableRealms">retrieveActionableRealms</a></li><li data-type='method'><a href="fluro.access.html#.retrieveCurrentSession">retrieveCurrentSession</a></li><li data-type='method'><a href="fluro.access.html#.setDefaultApplication">setDefaultApplication</a></li></ul></li><li><a href="fluro.api.html">api</a><ul class='methods'><li data-type='method'><a href="fluro.api.html#.delete">delete</a></li><li data-type='method'><a href="fluro.api.html#.get">get</a></li><li data-type='method'><a href="fluro.api.html#.post">post</a></li><li data-type='method'><a href="fluro.api.html#.put">put</a></li></ul></li><li><a href="fluro.asset.html">asset</a><ul class='methods'><li data-type='method'><a href="fluro.asset.html#.avatarUrl">avatarUrl</a></li><li data-type='method'><a href="fluro.asset.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="fluro.asset.html#.filesize">filesize</a></li><li data-type='method'><a href="fluro.asset.html#.getUrl">getUrl</a></li><li data-type='method'><a href="fluro.asset.html#.imageUrl">imageUrl</a></li><li data-type='method'><a href="fluro.asset.html#.playerUrl">playerUrl</a></li><li data-type='method'><a href="fluro.asset.html#.posterUrl">posterUrl</a></li><li data-type='method'><a href="fluro.asset.html#.typeFromMime">typeFromMime</a></li></ul></li><li><a href="fluro.auth.html">auth</a><ul class='methods'><li data-type='method'><a href="fluro.auth.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="fluro.auth.html#.changeAccount">changeAccount</a></li><li data-type='method'><a href="fluro.auth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="fluro.auth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="fluro.auth.html#.impersonate">impersonate</a></li><li data-type='method'><a href="fluro.auth.html#.login">login</a></li><li data-type='method'><a href="fluro.auth.html#.logout">logout</a></li><li data-type='method'><a href="fluro.auth.html#.refreshAccessToken">refreshAccessToken</a></li><li data-type='method'><a href="fluro.auth.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="fluro.auth.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="fluro.auth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="fluro.auth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="fluro.auth.html#.set">set</a></li><li data-type='method'><a href="fluro.auth.html#.signup">signup</a></li><li data-type='method'><a href="fluro.auth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="fluro.cache.html">cache</a><ul class='methods'><li data-type='method'><a href="fluro.cache.html#.get">get</a></li><li data-type='method'><a href="fluro.cache.html#.reset">reset</a></li></ul></li><li><a href="fluro.components.html">components</a><ul class='methods'><li data-type='method'><a href="fluro.components.html#.hydrateModel">hydrateModel</a></li></ul></li><li><a href="fluro.content.html">content</a><ul class='methods'><li data-type='method'><a href="fluro.content.html#.duplicate">duplicate</a></li><li data-type='method'><a href="fluro.content.html#.external">external</a></li><li data-type='method'><a href="fluro.content.html#.form">form</a></li><li data-type='method'><a href="fluro.content.html#.get">get</a></li><li data-type='method'><a href="fluro.content.html#.keys">keys</a></li><li data-type='method'><a href="fluro.content.html#.query">query</a></li><li data-type='method'><a href="fluro.content.html#.related">related</a></li><li data-type='method'><a href="fluro.content.html#.retrieve">retrieve</a></li><li data-type='method'><a href="fluro.content.html#.slug">slug</a></li><li data-type='method'><a href="fluro.content.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="fluro.content.html#.submitPost">submitPost</a></li><li data-type='method'><a href="fluro.content.html#.thread">thread</a></li><li data-type='method'><a href="fluro.content.html#.values">values</a></li></ul></li><li><a href="fluro.date.html">date</a><ul class='methods'><li data-type='method'><a href="fluro.date.html#.countdown">countdown</a></li><li data-type='method'><a href="fluro.date.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="fluro.date.html#.formatDate">formatDate</a></li><li data-type='method'><a href="fluro.date.html#.getAge">getAge</a></li><li data-type='method'><a href="fluro.date.html#.groupEventByDate">groupEventByDate</a></li><li data-type='method'><a href="fluro.date.html#.isDifferentTimezoneThanUser">isDifferentTimezoneThanUser</a></li><li data-type='method'><a href="fluro.date.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="fluro.date.html#.localDate">localDate</a></li><li data-type='method'><a href="fluro.date.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="fluro.date.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="fluro.date.html#.timeago">timeago</a></li><li data-type='method'><a href="fluro.date.html#.timeline">timeline</a></li><li data-type='method'><a href="fluro.date.html#.timestampToAmPm">timestampToAmPm</a></li><li data-type='method'><a href="fluro.date.html#.timezones">timezones</a></li></ul></li><li><a href="fluro.types.html">types</a><ul class='methods'><li data-type='method'><a href="fluro.types.html#.all">all</a></li><li data-type='method'><a href="fluro.types.html#.basicTypes">basicTypes</a></li><li data-type='method'><a href="fluro.types.html#.get">get</a></li><li data-type='method'><a href="fluro.types.html#.mapDefinitionItems">mapDefinitionItems</a></li><li data-type='method'><a href="fluro.types.html#.parentType">parentType</a></li><li data-type='method'><a href="fluro.types.html#.postableTypes">postableTypes</a></li><li data-type='method'><a href="fluro.types.html#.readable">readable</a></li><li data-type='method'><a href="fluro.types.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="fluro.types.html#.retrieve">retrieve</a></li><li data-type='method'><a href="fluro.types.html#.subTypes">subTypes</a></li><li data-type='method'><a href="fluro.types.html#.term">term</a></li></ul></li><li><a href="fluro.utils.html">utils</a><ul class='methods'><li data-type='method'><a href="fluro.utils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="fluro.utils.html#.comma">comma</a></li><li data-type='method'><a href="fluro.utils.html#.currencySymbol">currencySymbol</a></li><li data-type='method'><a href="fluro.utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="fluro.utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="fluro.utils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="fluro.utils.html#.getFlattenedFields">getFlattenedFields</a></li><li data-type='method'><a href="fluro.utils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="fluro.utils.html#.guid">guid</a></li><li data-type='method'><a href="fluro.utils.html#.hash">hash</a></li><li data-type='method'><a href="fluro.utils.html#.injectScript">injectScript</a></li><li data-type='method'><a href="fluro.utils.html#.machineName">machineName</a></li><li data-type='method'><a href="fluro.utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="fluro.utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="fluro.utils.html#.processCardPrioritySort">processCardPrioritySort</a></li></ul></li><li><a href="fluro.video.html">video</a><ul class='methods'><li data-type='method'><a href="fluro.video.html#.hhmmss">hhmmss</a></li><li data-type='method'><a href="fluro.video.html#.readableMilliseconds">readableMilliseconds</a></li><li data-type='method'><a href="fluro.video.html#.readableSeconds">readableSeconds</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">asset</h1> <section> <header> <h2> <span class="ancestors"><a href="fluro.html">fluro</a>.</span> asset </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="asset"><span class="type-signature"></span>new asset<span class="signature">(fluro)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line15">line 15</a> </li></ul></dd> </dl> <div class="description"> Creates a new FluroAsset instance. This module provides a number of helper functions for managing asset, image, video and audio items in Fluro </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fluro</code></td> <td class="type"> <span class="param-type">FluroCore</span> </td> <td class="description last">A reference to the parent instance of the FluroCore module. The FluroAsset module is usually created by a FluroCore instance that passes itself in as the first argument.</td> </tr> </tbody> </table> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".coverUrl"><span class="type-signature">(static) </span>coverUrl<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line262">line 262</a> </li></ul></dd> </dl> <div class="description"> A helper function to retrieve the main image for an event, group, realm or other content </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/event/5be504eabf33991239599d63?w=100&amp;h=100' fluro.asset.coverUrl('5be504eabf33991239599d63', 'event', {w:100, h:100})</code></pre> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".avatarUrl"><span class="type-signature">(static) </span>avatarUrl<span class="signature">(personID, style, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line207">line 207</a> </li></ul></dd> </dl> <div class="description"> A helper function to generate a url for retrieving a user, persona or contact's avatar </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/avatar/contact/5be504eabf33991239599d63?w=100&amp;h=100' fluro.asset.avatarUrl('5be504eabf33991239599d63', 'contact', {w:100, h:100})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>personID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The id of the person you want to retrieve the avatar for</td> </tr> <tr> <td class="name"><code>style</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Can be 'contact', 'persona' or 'user'</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>w</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">The width of the image you are requesting from Fluro</td> </tr> <tr> <td class="name"><code>h</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">The height of the image you are requesting from Fluro</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A full URL that links to the image the user is requesting </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".downloadUrl"><span class="type-signature">(static) </span>downloadUrl<span class="signature">(assetID, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line320">line 320</a> </li></ul></dd> </dl> <div class="description"> A helper function that returns a download url for a specific asset </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/download/5be504eabf33991239599d63' fluro.asset.downloadUrl('5be504eabf33991239599d63') // returns 'https://api.fluro.io/download/5be504eabf33991239599d63/file/MyFile.docx' fluro.asset.downloadUrl('5be504eabf33991239599d63', {filename:'MyFile.docx'})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>assetID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The id of the asset, or the asset object you want to download</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>filename</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The filename you want to download the file as</td> </tr> <tr> <td class="name"><code>extension</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The extension of the file you want to download, eg. 'pdf'</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A full URL that will download the file </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".filesize"><span class="type-signature">(static) </span>filesize<span class="signature">(bytes)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line680">line 680</a> </li></ul></dd> </dl> <div class="description"> Helper function to translate bytes into a human readable format </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns '1mb' fluro.asset.filesize(1000000)</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>bytes</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">The number of bytes</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> The human readable filesize </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".getUrl"><span class="type-signature">(static) </span>getUrl<span class="signature">(assetID, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line107">line 107</a> </li></ul></dd> </dl> <div class="description"> This function generates a url for the binary data of an asset, image, audio, or video file that has been uploaded to Fluro </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/5be504eabf33991239599d63' fluro.asset.getUrl('5be504eabf33991239599d63') // returns 'https://api.fluro.io/get/5be504eabf33991239599d63/file/MyFile.pdf' fluro.asset.getUrl('5be504eabf33991239599d63', {filename:'MyFile.pdf'})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>assetID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The _id of the item you want to retrieve</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A valid Fluro URL </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".imageUrl"><span class="type-signature">(static) </span>imageUrl<span class="signature">(imageID, width, height, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line573">line 573</a> </li></ul></dd> </dl> <div class="description"> A helper function that creates a url image for a specified image </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/5be504eabf33991239599d63?w=800' fluro.asset.imageUrl('5be504eabf33991239599d63', 800) // returns 'https://api.fluro.io/get/5be504eabf33991239599d63/file/image.jpg?w=800' fluro.asset.imageUrl('5be504eabf33991239599d63', 800, null, {filename:'MyFile.pdf'})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>imageID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The id of the image or an object representing the image that has an _id property</td> </tr> <tr> <td class="name"><code>width</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">The width of the image to retrieve from Fluro. If none is specified then will default to a size based on the requesting user's screen dimensions.</td> </tr> <tr> <td class="name"><code>height</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">The height of the image to retrieve from Fluro. If none is specified then will default to a size based on the requesting user's screen dimensions.</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>quality</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">The quality of the image to retrieve from Fluro as a percent eg. 85</td> </tr> <tr> <td class="name"><code>filename</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The filename to use for the image url</td> </tr> <tr> <td class="name"><code>extension</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">An extension to use for the url if no filename is specified</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A full URL of the image </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".playerUrl"><span class="type-signature">(static) </span>playerUrl<span class="signature">(videoID, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line157">line 157</a> </li></ul></dd> </dl> <div class="description"> This function generates a player url for a video file that has been uploaded to Fluro This is useful to force browsers to renderer a html5 video player instead of downloading the video file on desktop </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/player?url=https://api.fluro.io/get/5be504eabf33991239599d63' fluro.asset.playerUrl('5be504eabf33991239599d63')</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>videoID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The _id of the video you want to play</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A valid Fluro URL </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".posterUrl"><span class="type-signature">(static) </span>posterUrl<span class="signature">(videoID, width, height, params)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line440">line 440</a> </li></ul></dd> </dl> <div class="description"> A helper function that returns a poster image for a specified video </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63?w=1920&amp;h=1080' fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, 1080) // returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63/file/file.jpg?w=1920&amp;h=1080' fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, 1080, {extension:'jpg'}) //Not providing a height property will default to 16:9 ratio inferred from the width //returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63/file/MyPoster.jpg?w=1920&amp;h=1080' fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, null, {filename:'MyPoster.jpg'})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>videoID</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The id of the video, or a video object that has an _id property</td> </tr> <tr> <td class="name"><code>width</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">The width of the poster image. If none specified will default to 16:9 based on the requesting user's screen size</td> </tr> <tr> <td class="name"><code>height</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">The height of the poster image. If none specified will default to 16:9 based on the requesting user's screen size</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A full URL of the poster image </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".typeFromMime"><span class="type-signature">(static) </span>typeFromMime<span class="signature">(mimetype)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.asset.js.html">fluro.asset.js</a>, <a href="fluro.asset.js.html#line369">line 369</a> </li></ul></dd> </dl> <div class="description"> A helper function that returns what type of content Fluro will attribute a specified mimetype to </div> <h5>Example</h5> <pre class="prettyprint"><code>// returns 'audio' fluro.asset.typeFromMime('audio/aac') // returns 'video' fluro.asset.typeFromMime('video/ogg') // returns 'asset' fluro.asset.typeFromMime('application/pdf')</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>mimetype</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The mimetype of a file</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Whether this mimetype is an 'asset', 'video', 'image', or 'audio' file </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Aug 06 2020 08:04:44 GMT+1000 (Australian Eastern Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>