npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chute

v0.1.5

Published

API client for Chute platform.

Downloads

14

Readme

Chute

Chute makes it possible for you to easily organize, store and serve photos and videos. This NPM package provides you with a wrapper for the Chute API. You can learn more about Chute http://getchute.com and explore the API at http://picture.io.

Installation

npm install chute

Getting Started

  1. Sign up for an account at Chute
  2. Install this library
  3. Read the API docs for better understanding
  4. Read the annotated source for even better understanding of what's under the hood

Usage

Initialize:

var Chute = require('chute');
var client = new Chute;
client.set({
	token: 'access token',
	id: 'app id'
});

Chutes

Chutes allow you to manage sets of photos - you can think of them like albums.

Find:

// all chutes found
client.chutes.all(function(err, chutes){
	for(var i = 0; i < chutes.length; i++) {
		chute.id;
	}
});

// chute with ID=12345 found
client.chutes.find({ id: 12345 }, function(err, chute){
	chute.id;
});

// chute with ID=12345 found with contributors list inside
client.chutes.find({ id: 12345, contributors: true }, function(err, chute){
	chute.contributors;
});

// chute with ID=12345 found with members list inside
client.chutes.find({ id: 12345, members: true }, function(err, chute){
	chute.members;
});

// chute with ID=12345 found with parcels list inside
client.chutes.find({ id: 12345, parcels: true }, function(err, chute){
	chute.parcels;
});

// chute with ID=12345 found with everything inside
client.chutes.find({
	id: 12345,
	contributors: true,
	members: true,
	parcels: true
}, function(err, chute){
	chute.id;
});

Create:

// chute created
client.chutes.create({ name: 'Testing' }, function(err, chute){
	chute.id;
});

Update:

// chute with ID=235345 changed name to 'New name'
client.chutes.update({ id: 235345, name: 'New name' }, function(err, chute){
	chute.id;
});

Remove:

// chute with ID=12345 removed
client.chutes.remove({ id: 12345 }, function(err){
	
});

Assets

Assets represent photos and videos contained within a Chute.

Find:

// asset with ID=12345 found
client.assets.find({ id: 12345 }, function(err, asset){
	asset.id;
});

// asset with ID=12345 found with comments inside
client.assets.find({ id: 12345, comments: true }, function(err, asset){
	asset.comments;
});

Customize:

client.assets.find({ id: 12345 }, function(err, asset){
	asset.url // http://media.getchute.com/media/:id
	asset.url.width(640) // http://media.getchute.com/media/:id/w/640
	asset.url.height(480) // http://media.getchute.com/media/:id/h/480
	asset.url.fill(640, 480) // http://media.getchute.com/media/:id/640x480
	asset.url.fit(640, 480) // http://media.getchute.com/media/:id/fit/640x480
});

Like:

client.assets.heart({ id: 12345 }, function(err, asset){
	// +1 to asset with ID=12345
});

client.assets.unheart({ id: 12345 }, function(err, asset){
	// -1 to asset with ID=12345
});

Remove:

client.assets.remove({ id: 12345 }, function(err){
	// asset with ID=12345 removed
});

Bundles

Bundles allow you to create dynamic sets of photos

Find:

// bundle with ID=12345
client.bundles.find({ id: 12345 }, function(err, bundle){
	bundle.id;
});

Create:

client.bundles.create({
	ids: [134234, 534125]
}, function(err, bundle){
	// bundle with assets 134234 and 534125 created
});

Remove:

client.bundles.remove({ id: 12345 }, function(err){
	// bundle with ID=12345 removed
});

Uploads

Chute provides a simple upload flow that provides image processing and more.

// info about files
var files = [{ filename: 'image.jpg', size: 124235, md5: '0cc175b9c0f1b6a831c399e269772661' }];
// ID of chute which you want upload image to
var chutes = [12423523];

client.uploads.upload({ files: files, chutes: chutes }, function(err, assets){
	// assets is an array of asset IDs, which were just uploaded
});

Tests

Put your app credentials(access token and id) into test and run it with: mocha --timeout 10000

License

© Chute Corporation.