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

tumblr-promise

v0.0.1

Published

minimal, promise-based tumblr api client

Downloads

6

Readme

tumblr-promise

version Build Status Coverage Status dependencies

minimal, promise-based tumblr api client for node.js

:exclamation: This project is in early development. Don't assume all features described here are functional. See this note re: versioning

Why?

It's true that there are plenty of other tumblr clients out there for node, including an official driver. However, I wanted one that:

  • doesn't require OAuth tokens to instantiate the client by default
  • extends functionality of most-used apis
  • isn't bloated with rarely-used apis
  • exposes chainable promises rather than callbacks
  • is maintained :grin:

This package is designed to be able to fetch posts using several query parameters at once while sorting and transforming the data on the fly. It is very flexible but its overall api coverage is opinionated and selective; ideally it would cover the entire api, so pull requests are welcome, but I don't expect it to ever have 100% coverage. If you're looking for a more generic wrapper I would recommend the official client.

Installation

with npm and node ^6.0.0:

npm install tumblr-promise --save

Authentication

Depending on the request, tumblr api endpoints require different forms of authentication. Some are unauthenticated, the bulk need an api key, and the most complex require an OAuth token. Check out the docs for details and instructions for generating a token.

Usage

The constructor requires an api_key since you need one to make any of the requests this library supports. oauth_token is an optional parameter.

const Tumblr = require('tumblr-promise')

const api = Tumblr.new({
  name: 'yoursubdomain',  //  yoursubdomain.tumblr.com
  api_key: 'YOUR_CONSUMER_SECRET'
})

//  simplest invocation
let last20Posts = api.get()

//  the fun part...
api
.get(5)
.skip(10)
.filter('portfolio, case studies')  // filter by #tag
.filter(['array', 'works', 'too'])
.media('photo')
.media('video') //  multiple content types in one request!
.transform(p => { //  map function to apply to every post
  delete p.foo
  p.bar = p.baz * 2
  return p
})
.then(console.log)
.catch(console.error)

Testing

To run the tests locally, you'll need to add a test/.env with your blog name and api key values: cp test/.env.sample test/.env

License

MIT