https://github.com/basemax/bower-package-nodejs
This is a NodeJS module for getting information about Bower packages from the Bower registry, which is a REST API. It can be used to search for packages, list all packages, and check if a package exists. The package written in JavaScript.
https://github.com/basemax/bower-package-nodejs
bower bower-api bower-javascript bower-js bower-json bower-npm bower-npm-checker bower-package bower-packages bower-repository javascript javascript-bower js js-bower npm-bower
Last synced: about 1 year ago
JSON representation
This is a NodeJS module for getting information about Bower packages from the Bower registry, which is a REST API. It can be used to search for packages, list all packages, and check if a package exists. The package written in JavaScript.
- Host: GitHub
- URL: https://github.com/basemax/bower-package-nodejs
- Owner: BaseMax
- License: gpl-3.0
- Created: 2023-04-09T05:36:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-09T13:21:40.000Z (about 3 years ago)
- Last Synced: 2025-03-28T17:08:04.334Z (about 1 year ago)
- Topics: bower, bower-api, bower-javascript, bower-js, bower-json, bower-npm, bower-npm-checker, bower-package, bower-packages, bower-repository, javascript, javascript-bower, js, js-bower, npm-bower
- Language: JavaScript
- Homepage: https://bower.io
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bower-package-nodejs
This is a NodeJS module for getting information about Bower packages from the Bower registry, which is a REST API. It can be used to search for packages, list all packages, and check if a package exists. The package written in JavaScript.
## Features
- Search packages
- List packages (All packages, or in chunks)
- Internal cache feature to reduce the number of requests
- Check package exists and name availability
## Example
Import the module:
```javascript
const { searchPackage, listPackages, packageExists } = require("./bower-package");
```
Search and get the results:
```javascript
searchPackage("jquery").then((results) => {
console.log("Search results: " + results.length);
// Iterate over the results
results.forEach((result) => {
console.log(result);
});
});
```
Get the list of all packages:
```javascript
listPackages().then((packages) => {
console.log("List of packages: " + packages.length);
// Iterate over the results
packages.forEach((package) => {
console.log(package);
});
});
```
Get the list of packages and chunk them into arrays of 20 packages:
```javascript
listPackages(20).then((chunks) => {
console.log("List of chunks: " + chunks.length)
console.log("List of packages: " + chunks.reduce((sum, chunk) => sum + chunk.length, 0));
// Iterate over the chunks
chunks.forEach((chunk) => {
console.log(chunk);
// Iterate over the packages in the chunk
// chunk.forEach((package) => {
// console.log(package);
// });
});
});
```
Check a package exists:
```javascript
packageExists("jquery").then((exists) => {
console.log("Package exists: " + exists)
});
```
Copyright 2023, Max Base