https://github.com/spikehd/node-beatsaver
An API wrapper for https://beatsaver.com
https://github.com/spikehd/node-beatsaver
Last synced: about 2 months ago
JSON representation
An API wrapper for https://beatsaver.com
- Host: GitHub
- URL: https://github.com/spikehd/node-beatsaver
- Owner: SpikeHD
- License: gpl-3.0
- Created: 2020-12-07T01:02:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-01T08:19:53.000Z (over 5 years ago)
- Last Synced: 2025-02-18T18:47:13.851Z (over 1 year ago)
- Language: JavaScript
- Size: 62.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
  
# node-beatsaver
A function-based API wrapper for https://beatsaver.com
https://www.npmjs.com/package/beatsaver
# Installation
Run `npm install beatsaver` and `require` it in your project like so:
```js
const bs = require('beatsaver')
```
# Usage
All functions are async unless listed otherwise.
Jump to:
* [Functions](#functions)
* [Examples](#examples)
* [Contributing](#contributing)
# Functions
`find(query)`
Find maps by searching with a query.
| Parameter | Type |
| --------- | ---- |
| query | String |
---
`getbyHash(hash)`
Get maps details by hash string.
| Parameter | Type |
| --------- | ---- |
| hash | String |
---
`getByKey(key)`
Get map details by it's key
| Parameter | Type |
| --------- | ---- |
| key | String |
---
`getMaps(opts)`
Find maps by sort method.
| Parameter | Type |
| --------- | ---- |
| opts | Object |
### Using the `opts` object
| Key | Description | Optional? |
| --------- | ---- | --------- |
| sort | Method to sort by | Yes - defaults to 'hot' |
| page | Page to get | Yes - defaults to 1 |
### Available sort methods
* `uploader` (include `id` param in your options)
* `hot`
* `rating`
* `latest`
* `downloads`
* `plays`
---
# Examples
## Finding maps
```js
const maps = await bs.find('t+pazolite')
```
## Getting a map by hash
```js
const maps = await bs.getByHash('7f344bbf7ec69b67bd3bc9f03bae39d0b3789120')
```
## Getting a map by key
```js
const maps = await bs.getByKey('105a9')
```
## Getting maps by sorting method
Available sort methods:
* `uploader` (include `id` param in your options)
* `hot`
* `rating`
* `latest`
* `downloads`
* `plays`
Also allows page navigation.
```js
// Hot maps
const byHot = await bs.getMaps({ sort: 'hot' })
// Maps from uploader
const byUploader = await bs.getMaps({ sort: 'uploader', id: '5cff0b7698cc5a672c8544e6' })
// Second page of top rated maps
const byRating = await bs.getMaps({ sort: 'rating', page: 2 })
// Etc...
```
# Contributing
Issues, PRs, etc., are all welcome!