Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Deprecated: JavaScript client library for the FilePreviews.io service

License

Notifications You must be signed in to change notification settings

filepreviews/filepreviews.js

Repository files navigation

⚠️ Deprecated ⚠️

FilePreviews.io

Build Status

JavaScript client library for the FilePreviews.io service.

How to use

Install using bower

bower install filepreviews

Use from our CDN distribution

<script src="https://dufozrddxzwdn.cloudfront.net/2.0.3/filepreviews.min.js"></script>
<script src="https://dufozrddxzwdn.cloudfront.net/2.0.3/filepreviews.js"></script>

Download

You can also download the latest version from the releases page.

Example code

var previews = new FilePreviews({
  debug: true,
  apiKey: 'API_KEY_HERE'
});

previews.generate(url, function(err, result) {
  console.log(result.id);
  console.log(result.status);

  previews.retrieve(result.id, function(err, result) {
    console.log(result);
  });
});

Options

You can optinally send an options object.

var previews = new FilePreviews({
  debug: true,
  apiKey: 'CLIENT_API_KEY_HERE'
});

var options = {
  size: {
    width: 250,
    height: 250,
  },
  metadata: ['exif', 'ocr', 'psd'],
  format: 'jpg'
}

previews.generate(url, options, function(err, result) {
  console.log(result.previewURL);
  console.log(result.metadata);
});

Build

$ git clone https://github.com/GetBlimp/filepreviews.js.git
$ cd filepreviews.js
$ npm run build

Publish

$ npm run publish