1.1.0 • Published 1 year ago

scp-api.js v1.1.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

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)
}

Disclaimer

This project is fully made for educational purposes

1.1.0

1 year ago