Skip to content
Node module for uploadcare.com
Branch: master
Clone or download
Latest commit 7930578 Jan 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Add CLI for retrieving file or group info Oct 19, 2015
examples
lib #18 Calling the callback with the error when _submit is called instea… Jan 18, 2018
.gitignore Cleaning up usage. Mar 28, 2014
README.md
package.json

README.md

uploadcare-node

Node module for uploadcare.com that allows API interaction as well as local file upload.

Usage

    var uploadcare = require('../lib/main')('public_key', 'private_key'),
        fs = require('fs');

    
    // handler is a callback function
    // in the form function(err, data) { // code to handle response }
    
    
    //API interaction
    uploadcare.files.info('file_id', handler);
    uploadcare.files.store('file_id', handler);
    uploadcare.files.remove('file_id', handler);
    uploadcare.groups.info('group_id', handler);

    //
    //Paginated list of files/groups info
    uploadcare.files.list({page: 1, limit: 100}, handler);
    uploadcare.groups.list({page: 1, limit: 100}, handler);

    //
    //Upload from file
    uploadcare.file.upload(fs.createReadStream(path), function(err,res){
        //Res should contain returned file ID
        console.log(err,res);
    });

    //
    //Upload from URL
    uploadcare.file.fromUrl('http://host/image/path', function(err,res){
        //Res should contain returned file ID
        console.log(err,res);
    })

Installation

npm install uploadcare

CLI

Install uploadcare globally (npm install -g uploadcare) and you have a CLI tool for interacting with the REST API.

Commands

info / i

Get info for an uploadcare file or group.

# Single file
uc info --pub=demopublickey --priv=demoprivatekey 1b53f25b-ac5e-46e7-9a76-8bf77d755c55
# Group of files
uc info --pub=demopublickey --priv=demoprivatekey 80077b0a-3882-4bbc-b4f4-aabf45ff8fb7~3

Options

  • -u, --pub Public key to use (REQUIRED)
  • -r, --priv Private key to use (REQUIRED)
  • -p, --pretty Pretty print the response
You can’t perform that action at this time.