File: twitter-streaming/node_modules/ntwitter/package.json

Recommend this page to a friend!
  Classes of Igor Escobar   Terminal Crossword   twitter-streaming/node_modules/ntwitter/package.json   Download  
File: twitter-streaming/node_modules/ntwitter/package.json
Role: Example script
Content type: text/plain
Description: Example script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 2 years ago
Size: 4,943 bytes
 

Contents

Class file image Download
{ "name": "ntwitter", "version": "0.5.0", "description": "Asynchronous Twitter REST/stream/search client API for node.js.", "keywords": [ "twitter", "streaming", "oauth" ], "homepage": "https://github.com/AvianFlu/ntwitter", "author": { "name": "jdub, changes by AvianFlu" }, "licenses": { "type": "MIT", "url": "http://github.com/AvianFlu/ntwitter/raw/master/LICENSE" }, "repository": { "type": "git", "url": "http://github.com/AvianFlu/ntwitter.git" }, "dependencies": { "oauth": ">=0.8.4", "cookies": "0.1.x", "keygrip": "0.2.x" }, "devDependencies": { "should": "*", "mocha": "*" }, "engines": { "node": ">=0.4.0" }, "main": "./lib/twitter", "readme": "Asynchronous Twitter client API for node.js\n===========================================\n\n[ntwitter](http://github.com/AvianFlu/ntwitter) is an improved version of jdub's [node-twitter](http://github.com/jdub/node-twitter), which in turn was inspired by, and uses some code from, technoweenie's [twitter-node](http://github.com/technoweenie/twitter-node).\n\n\n## Installation\n\nYou can install ntwitter and its dependencies with npm: `npm install ntwitter`.\n\n\n## Getting started\n\nThis library is, for the most part, the same API as `node-twitter`. Much of the documentation below is straight from `node-twitter` - credit goes to [jdub](http://github.com/jdub) for putting all this together in the first place. \n\nThe most significant API change involves error handling in callbacks. Callbacks now receive the error as a separate parameter, rather than as part of the data. This is consistent with node's standard library. Callbacks should now look something like this:\n\n``` javascript\nfunction (err, result) {\n if (err) return callback(err);\n\n // Do something with 'result' here\n}\n```\n\nWhere `callback` is the parent function's callback. (Or any other function you want to call on error.)\n\n\n### Setup API \n\nThe keys listed below can be obtained from [dev.twitter.com](http://dev.twitter.com) after [setting up a new App](https://dev.twitter.com/apps/new).\n\n``` javascript\nvar twitter = require('ntwitter');\n\nvar twit = new twitter({\n consumer_key: 'Twitter',\n consumer_secret: 'API',\n access_token_key: 'keys',\n access_token_secret: 'go here'\n});\n```\n\n\n### REST API \n\nInteraction with other parts of Twitter is accomplished through their RESTful API.\nThe best documentation for this exists at [dev.twitter.com](http://dev.twitter.com). Convenience methods exist\nfor many of the available methods, but some may be more up-to-date than others.\nIf your Twitter interaction is very important, double-check the parameters in the code with \nTwitter's current documentation.\n\nNote that all functions may be chained:\n\n``` javascript\ntwit\n .verifyCredentials(function (err, data) {\n console.log(data);\n })\n .updateStatus('Test tweet from ntwitter/' + twitter.VERSION,\n function (err, data) {\n console.log(data);\n }\n );\n```\n\n### Search API \n\n``` javascript\ntwit.search('nodejs OR #node', {}, function(err, data) {\n console.log(data);\n});\n```\n\n### Streaming API \n\nThe stream() callback receives a Stream-like EventEmitter.\n\nHere is an example of how to call the `statuses/sample` method:\n\n``` javascript\ntwit.stream('statuses/sample', function(stream) {\n stream.on('data', function (data) {\n console.log(data);\n });\n});\n```\n \nHere is an example of how to call the 'statuses/filter' method with a bounding box over San Fransisco and New York City ( see streaming api for more details on [locations](https://dev.twitter.com/docs/streaming-api/methods#locations) ):\n\n``` javascript\ntwit.stream('statuses/filter', {'locations':'-122.75,36.8,-121.75,37.8,-74,40,-73,41'}, function(stream) {\n stream.on('data', function (data) {\n console.log(data);\n });\n});\n```\n\nntwitter also supports user and site streams:\n\n``` javascript\ntwit.stream('user', {track:'nodejs'}, function(stream) {\n stream.on('data', function (data) {\n console.log(data);\n });\n stream.on('end', function (response) {\n // Handle a disconnection\n });\n stream.on('destroy', function (response) {\n // Handle a 'silent' disconnection from Twitter, no end/error event fired\n });\n // Disconnect stream after five seconds\n setTimeout(stream.destroy, 5000);\n});\n```\n\n## Contributors\n\n[Lots of people contribute to this project. You should too!](https://github.com/AvianFlu/ntwitter/contributors)\n\n## TODO\n\n- Complete the convenience functions, preferably generated\n- Support [recommended reconnection behaviour](https://dev.twitter.com/docs/streaming-apis/connecting#Best_practices) for the streaming APIs\n\n", "readmeFilename": "README.md", "_id": "ntwitter@0.5.0", "dist": { "shasum": "c3bb89bf05dd734793989b5206825e6bd4561dce" }, "_from": "ntwitter" }