node-bandcamp
node.js (unofficial) Bandcamp API.
Getting Started
npm install --save node-bandcamp
var bandcamp = require('node-bandcamp')
Searching for tracks
Specific tracks can be searched for using the trackSearch
method. This function takes the following parameters:
query
(str): The search query for which you want results.limit
(defaults to 20): The maximum number of results you want returned. Defaults to20
.
The function will recursively query Bandcamp until results are exhausted or the limit is hit.
var bandcamp = ; bandcamp;
Returns a promise
, which will eventually resolve as an array of search results. Results are in the format:
Streaming a track
A specific track can be streamed using the getTrack
method. This function takes just one parameter, the Bandcamp URL string retrieved using the previously discussed trackSearch
method.
var bandcamp = ; bandcamp;
Returns a promise
, which will eventually resolve as an audio stream.
Getting track details
The details for a specific track (title, duration, etc.) can be retrieved using the getDetails
method. This function takes the Bandcamp URL string for the track as a parameter, and returns a promise
which will eventually resolve as an object in the same format as search results:
Testing
All tests for this package are within the __tests__/
directory. If you wish to run the tests:
git clone git@github.com:jakemmarsh/node-bandcamp.git
cd node-bandcamp
npm install
npm test