request-with-buffer
v3.0.3
Published
As simple as it gets
Downloads
5
Maintainers
Readme
Request With Buffer
As simple as it gets
Basic Usage
import { RequestService } from "request-with-buffer"
const requestService: RequestService = RequestService.getInstance()
const bufferIntervalInMilliSeconds: number = 60 * 60 * 1000 // hourly
const exampleURL: string = "http://api.open-notify.org/iss-now.json"
const options: any = {
url: exampleURL,
}
const result: any =
await requestService.get(options, bufferIntervalInMilliSeconds)
console.log(result)
Advanced Usage
import { IBufferEntry, RequestService } from "request-with-buffer"
// see basic usage plus:
const exampleURL: string = "http://api.open-notify.org/iss-now.json"
const options: any = {
url: exampleURL,
}
// you might want to check what's in the buffer
const bufferContent: IBufferEntry[] = requestService.getCompleteBufferContent()
// you might want to clear the buffer from time to time
requestService.deleteBuffer()
// you might want to clear a specific buffer entry from time to time
requestService.deleteBufferEntry(options)
Feedback
If you find any issues or want to share improvement proposals in general feel free to open an issue here.
Contribute
I am interested in save and useful enhancements. Feel free to create Pull Requests on my Repository.