Query Metadata

Once a file has been uploaded you can use the metadata method to get metadata about the file like its pixel dimensions.

Syntax

Note: Security policies and signatures should be included as options when the client is initialized with your API key if your account has security enabled.

<script src="https://static.filestackapi.com/v3/filestack-0.5.2.js"></script>
<script type="text/javascript">
  var client = filestack.init('yourApiKey', { policy: 'policy', signature: 'signature' });
  client.metadata(handle, options);
</script>

Example Metadata Code

Get the Metadata for an existing Filestack Handle
var filestackHandle = 'qHi4LxRh28IeEBdJcFpw' var log = function(result) { console.log(JSON.stringify(result)) } client.metadata(filestackHandle, { height: true, width: true }).then(log)

Parameters

Client Initialization Options
An optional dictionary of key-value pairs that influence the Filestack client.
Security
Object
{ policy: POLICY, signature: SIGNATURE }

If you have security enabled, you will need to initialize the client with a valid Filestack policy and signature in order to perform the requested call. This allows you to select who can and cannot perform certain actions on your site. Read more about security and how to generate policies and signatures

handle
the file to check the metadata for
Handle
String
'handle'

The Filestack handle for the file to check the metadata for.

options
An optional dictionary of key-value pairs that specify what metadata you want back. By default, we return any metadata we get without having to run over the contents of the file (currently: size, mimetype, filename, uploaded, writeable, location, path, container).
size
Boolean
size: true

Specify that you want the size of the file returned as a number in bytes.

mimetype
Boolean
mimetype: true

Specify that you want the mimetype of the file returned as a string.

filename
Boolean
filename: true

Specify that you want the name of the file returned as a string.

width
Boolean
width: true

Specify that you want the width of the image returned as an integer in pixels. If the file is not an image, width is set to null.

height
Boolean
height: true

Specify that you want the height of the image returned as an integer in pixels. If the file is not an image, height is set to null.

uploaded
Boolean
uploaded: true

Specify that you want the timestamp of when the file was uploaded to Filestack, as a javascript Date object

writeable
Boolean
writeable: true

Specify that you want to know whether the file is writeable. The value will be true or false.

cloud
Boolean
cloud: true

Applies to files uploaded from cloud drives. Specifies that you want to see what metadata is available about the file where it is stored, such as original creation date and caption (if the file was picked from Instagram or Facebook).

source url
Boolean
source_url: true

If your file was selected via the image search then you can request the original url of the file.

Hashing Algorithms

Note:You can specify more than one algorithm in your code, but We will return only one hash based on the lexicographical order of the hashing algorithm names. So for instance, if you specify sha-256 and md5 in the same request, we will compute and return only the MD5 hash.

MD5 Hash
Boolean
md5: true

Specify that you want the md5 hash of the file returned as a string.

SHA-1 Hash
Boolean
sha1: true

Specify that you want the SHA-1 hash of the file returned as a string.

SHA-224 Hash
Boolean
sha224: true

Specify that you want the SHA-224 hash of the file returned as a string

SHA-256 Hash
Boolean
sha256: true

Specify that you want the SHA-256 hash of the file returned as a string

SHA-384 Hash
Boolean
sha384: true

Specify that you want the SHA-384 hash of the file returned as a string

SHA-512 Hash
Boolean
sha512: true

Specify that you want the SHA-512 hash of the file returned as a string

Storage

Storage Location
Boolean
location: true

Specify that you want to know the storage location (S3, etc.) of a stored file, if available, as a string

Storage Path
Boolean
path: true

Specify that you want to know the storage path of a stored file, if available, as a string.

Storage Container
Boolean
container: true

Specify that you want to know the storage container of a stored file, if available, as a string

EXIF
Boolean
exif: true

If you would like to view the exif metadata of a photo as a JSON object, the request must be accompanied by a valid security policy and signature. Without the policy and signature, the EXIF data will not be returned. This is required because EXIF metadata can include personally identifiable information.