Query Metadata

Once a file has been uploaded you can use the metadata method to get metadata about the file via its handle.

You can add Filestack to your project quickly and easily using our CDN.

Or by installing Filestack-JS using NPM

You will need to instantiate the client with your API key and security or CNAME if they apply to you.

You may pass in an optional dictionary of key-value pairs to customize the options of client.metadata()

const client = filestack.init('Your_API_Key');
client.metadata(handle, options);

Metadata Options

An optional dictionary of key-value pairs that specify what metadata is returned.

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

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 signa true. Without the policy and signa true, the EXIF data will not be returned. This is required because EXIF metadata can include personally identifiable information.