Mailspring/docs/File.html
2015-10-02 10:57:48 -07:00

65 lines
2.4 KiB
HTML

---
layout: docs
title: File
---
<h2>Summary</h2>
<div class="markdown-from-sourecode">
<p><p>File model represents a File object served by the Nylas Platform API.
For more information about Files on the Nylas Platform, read the
<a href="https://nylas.com/docs/api#files">Files API Documentation</a></p>
<h2 id="attributes">Attributes</h2>
<p><code>filename</code>: <a href='attributestring.html'>AttributeString</a> The display name of the file. Queryable.</p>
<p><code>size</code>: <a href='attributenumber.html'>AttributeNumber</a> The size of the file, in bytes.</p>
<p><code>contentType</code>: <a href='attributestring.html'>AttributeString</a> The content type of the file (ex: <code>image/png</code>)</p>
<p><code>contentId</code>: <a href='attributestring.html'>AttributeString</a> If this file is an inline attachment, contentId
is a string that matches a cid:<value> found in the HTML body of a <a href='message.html'>Message</a>.</p>
<p>This class also inherits attributes from <a href='model.html'>Model</a></p>
</p>
</div>
<ul>
</ul>
<h3>Instance Methods</h3>
<h4 id=displayName class="function-name">
displayName(<span class="args"></span>) <a href="#displayName" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p><p>Files can have empty names, or no name. <code>displayName</code> returns the file&#39;s
name if one is present, and falls back to appropriate default name based on
the contentType. It will always return a non-empty string.</p>
</p>
</div>
<h4 id=displayExtension class="function-name">
displayExtension(<span class="args"></span>) <a href="#displayExtension" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns the file extension that should be used for this file.
Note that asking for the displayExtension is more accurate than trying to read
the extension directly off the filename. The returned extension may be based
on contentType and is always lowercase.</p>
</td></tr>
<tr><td class="markdown-from-sourecode"><p>Returns the extension without the leading &#39;.&#39; (ex: &#39;png&#39;, &#39;pdf&#39;)</p>
</td></tr>
</table>