transformit

Module for async transloadit jobs.

npm install transformit
6 downloads in the last day
46 downloads in the last week
177 downloads in the last month

transformit

Async transloadit uploads.

NPM david-dm.png

A convenience wrapper for binding form events and uploading files to transloadit. Calling the transformit function will return a transpulseit instance you can use to check the progress of your assembly.

Usage

var transformit = require('transformit')('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); // Transloadit Key

var transformed = transformit(document.getElementById('test-form'), {
    'trigger': false,
    'fields': {
        'encoder_key': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    },
    'templateId': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
});

transformed.on('progress', function (received, expected, assembly) {
    console.log(arguments);
    console.log((received / expected) * 100);
});

transformed.on('success', function (assembly) {
    console.log(assembly);
});

transformed.on('error', function (err) {
    console.log(err);
});

transformed.appendField('beep', 'boop');

transformed.upload(function (err) {
    // called after all uploads are finished
});

Installation

npm install transformit --save-dev

require in your clientside scripts and browserify on medium heat.

Goals

To provide a simple module for easily sending files to transloadit clientside. Where possible it keeps some of the same options and verbs as the transloadit jquery plugin. It does not provide the progress modal or a few other bells and whistles from the plugin.

Dependencies

Currently dependent on a global jquery $ object for use of the jsonp method.

npm loves you