request-with-buffer
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

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.

Package Sidebar

Install

npm i request-with-buffer

Weekly Downloads

9

Version

3.0.3

License

MIT

Unpacked Size

19.4 kB

Total Files

19

Last publish

Collaborators

  • michael-spengler