Socket
Book a DemoInstallSign in
Socket

embdr

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embdr

The Node.JS client to communicate with the Embdr REST API

0.0.6
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

# Embdr Client for Node.JS

The Node.JS client to communicate with the Embdr REST API

Dependencies

  • Node.JS

## Installation

You can install the client through NPM

npm install embdr

Example

var Embdr = require('embdr');

// Create a new embdr instance
var embdr = new Embdr('VUT6blsAabPE2Vw7BkDZiCJ45duoBtit');

// Process a file on disk
embdr.process('path/to/my/file.xlsx', {
    // Invoked when something went wrong trying to contact the Embdr REST API
    'error': function(err) {
        console.error('Failed to process a resource');
        console.error(err);
    },

    // Invoked when the upload request finishes
    'start': function(resource) {
        console.log('Uploaded a resource for processing');
        console.log(resource);
    },

    'thumbnails': {
        // Specify the desired sizes of the thumbnails
        'sizes': ['64x64', '256x256'],

        // Invoked when the thumbnails are ready
        'complete': function(thumbnails) {
            console.log('Generated thumbnails');
            console.log(thumbnails);
        }
    },

    'images': {
        // Specify the desired sizes of the image previews. When only one side of the dimension is
        // specified, the image will be scaled so the original ratio is retained. Image previews
        // will never be scaled up
        'sizes': ['768x'],

        // Invoked when the image previews are ready
        'complete': function(images) {
            console.log('Generated images');
            console.log(images);
        }
    },

    // Invoked when the entire file has been processed
    'complete': function(resource) {
        console.log('Completely processed a resource');
        console.log(resource);
    }
});

The process function is overloaded and can take other types such as HTTP links:

var url = 'https://upload.wikimedia.org/wikipedia/meta/b/be/Wikipedia-logo-v2_2x.png';
embdr.process(url, {
    'complete': function(resource) {
        console.log('Completely processed a URL
        ');
        console.log(resource);
    }
});

It can also take in any kind of readable stream:

var stream = myFunctionThatReturnsAStream();

embdr.process(stream, {
    'complete': function(resource) {
        console.log('Completely processed a resource');
        console.log(resource);
    }
});

Documentation

TODO

FAQs

Package last updated on 09 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.