To install use:
npm i scp-api.js
There is two ways to fetch data.
You can use the method API.fetchSCP
without creating an API instance first as it creates an API instance and returns the data fetched.
Or you can create and API instance and use getSCP
to take adventage of local cache data.
Here you have the two examples:
const { API } = require('scp-api.js')
console.log('---- Direct Method: ----')
try {
/* can also pass langs and other options */
/* API.fetchSCP('3007', 'es', { return_api }) // This will return the API instance instead */
console.log(await API.fetchSCP('3007'))
} catch (e) {
console.log(e)
}
console.log('---- Cache Method: ----')
const api = new API();
try {
await api.getSCP('3007'); // 3007 data
await api.getSCP('982'); // 982 data
console.log(api.scps) // Array of all SCPs fetched yet
} catch (e) {
console.log(e)
}
This project is fully made for educational purposes