A map or filter callback applied with each JSON result
objThe original, JSON parsed, iTunes search result object.
Returns result or
The default callback adds the required
guid property to
obj and returns it. For production I’d return a classy object.
The options for the fanboy cache:
cacheSize = 1024 * 1024 * 8The cache size passed to
country = 'us'The country code for the search API.
hostname = 'itunes.apple.com'The host name of the store.
media = 'all'The media type to search for.
objectMode = falseWhether this stream should behave as a stream of objects.
path = '/search'The path to the store.
port = 80The port to access the store.
ttl = 24 * 3600 * 1000Time in milliseconds before cached items go stale.
The fanboy module exports a single function that returns a new cache object (an instance of the
Fanboy class). To access the
require('fanboy'). fanboy streams do not validate or modify search terms written to them. Be aware that term validation is expected to be dealt with upstream.
StringThe name of the file system directory for the database.
opts()Optional parameters of the cache.
const fanboy =const cache =
const search = cachesearchsearch
Try running this with something like:
$ node example/search | json -ga collectionId
This will search remotely and cache the result. Until the term expires, subsequent requests hit the cache.
const lookup = cachelookuplookup
You can run this with:
$ node example/lookup | json
const suggest = cachesuggestsuggest
$ node example/suggest | json
If you have not searched before doing this, you will not get any results, because the suggestions index is populated as we are caching data. Pass a
Number to limit the number of suggestions retrieved.
The default limit of items emitted per term through this API is 50.
With npm, do:
$ npm install fanboy