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

edgecast

v0.0.2

Published

An API client for the Edgecast CDN

Downloads

36

Readme

#Edgecast JSON API Client in NodeJS Simple JSON Client built from Restify's JSONClient library. Specifically designed to set some simple defaults like token/account to reduce redundant signing header code and setting a base media path to use throughout your app.

##Installation

npm install edgecast

##Usage

To get your token and account number you will need access to http://my.edgecast.com. Token can be found under My Settings in the upper right corner and your account number is right underneath that by your account name.

Note: You can pass a wildcard in MediaPath if you want to clear whole directories like /media/1234/* if you have a directory structure to maintain things.

###CacheManagement

//see Usage to find token/account to sign
var edgecast = require ('edgecast').sign({
  token: 'supersecretclienttoken',
  account: '4characcountname'
});

//and use elsewhere like
var cm = require('edgecast').CacheManagement.setBaseMediaPath("http://prepended.domainpath.com");

cm.purge({
  MediaPath: "/some/path/tosomething/inthe/cdn.jpg",
  MediaType: 8
}, function (err, data) {
  if (!err) console.log(data);
});

//data will be {Id: 'some24charactersidnumber'}

And with request Id you can pull data about it like so...

cm.purge("some24charactersidnumber", function (err, data) {
  if (!err) console.log(data);
});

/*
{ AccountNumber: '4characcountname',
  CompleteDate: '2013-12-17 21:43',
  Id: 'some24charactersidnumber',
  InDate: '2013-12-17 21:42',
  MediaPath: 'http://prepended.domainpath.com/some/path/tosomething/inthe/cdn.jpg',
  MediaTypeId: 8
}
*/

And to force the CDN to load content

cm.load({
  MediaPath: "/some/path/tosomething/notinthe/cdn.jpg",
  MediaType: 8
}, function (err, data) {
  if (!err) console.log(data);
});

//data will be an empty object

Each callback can have req, res as extra parameters if you need the full request and response objects to sift through.

####Reference

From the Edgecast docs for ints to pass for MediaType: 2: Flash Media Streaming 3: HTTP Large 8: HTTP Small 14: Application Delivery Network (ADN)

####API

All methods return this in case you want to chain them in one call.

CacheManagement.setBaseMediaPath(string);

CacheManagement.purge({MediaPath: string, MediaType: number}, callback(err, data, req, res));

CacheManagement.purge(string, callback(err, data, req, res)); //read with 24 char Id number

CacheManagement.load({MediaPath: string, MediaType: number}, callback(err, data, req, res));

##Resources##

API Documentaiton (HTML): https://my.edgecast.com/uploads/ubers/1/docs/en-US/webhelp/b/RESTAPIHelpCenter/default.htm

API Documentation (PDF): https://my.edgecast.com/uploads/ubers/1/docs/en-US/Resources/b/EdgeCast_Web_Services_REST_API.pdf

#Todo CacheManagement is full featured and CacheSettings has been started, so there are lots more to add.

Write some tests.