Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
node-pexels
Advanced tools
Node unofiicial client for https://www.pexels.com API. Typescript definitions included.
Simple api client for Pexels powered by got package.
Check out Pexels API for API usage rules and key request.
Node 10+
Security updates. Removed es5 support in lib.
Fixes, deps update, etc.
Added retrieving single photo method (#1)
Some fixes in inner logic and interfaces. Added methods args validation. Some fixes in doc.
Some fixes in schema and ts definitions.
Hello, world! First version of package.
const Client = require('node-pexels').Client;
const fs = require('fs');
const client = new Client('your-api-key');
client.search('people', 5, 1)
.then((results) => {
// Do something with results
console.log(results);
if (results.photos.length > 0) {
const photo = results.photos[0];
const source = 'medium';
return client.fetch(photo, source)
} else {
throw new Error('no results found');
}
})
.then((file) => {
return new Promise(
(reject, resolve) => {
fs.writeFile(
`./img.${file.format}`,
file.data,
(err) => {
if (err) {
reject(err);
}
resolve();
}
);
}
);
})
.catch((error) => {
// Something bad happened
console.error(error);
});
Creates new API client instance.
Search request by provided query.
Search photo by provided id.
Popular photos request.
Fetch a photo file from the selected source.
Responses from pexels api.
Object containing an image buffer, and format.
You can find schemas here and response example on the Pexels API page.
Client use https. You can use http (if you really want to) by modifying endpoint
property of Client function.
FAQs
Node client for https://www.pexels.com API
The npm package node-pexels receives a total of 113 weekly downloads. As such, node-pexels popularity was classified as not popular.
We found that node-pexels demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.