$ npm install node-unsplash
var Unsplash = require('node-unsplash');
list photos of each page, suppor promise
Unsplash.page(1, function (err, photos) {
if (err) {
//handler error
}
//handler your photos
});
or use promise
Unsplash.page(1).then(function (photos) {
//handle your photos
}, function (err) {
//handle error
})
Params
keyword
: String 'your keyword',feature
: String 'all'/'feature',page
: Number
filter photos by keyword or feature, suppor promise
Unsplash.filter({
keyword: 'animal',
page: 1
}, function (err, photos) {
if (err) {
//handler error
}
//handler your photos
});
or use promise
Unsplash.filter({
keyword: 'animal',
page: 1
},.then(function (photos) {
//handle your photos
}, function (err) {
//handle error
})
MIT © Andrew Zhang