1.1.5 • Published 1 year ago

@hckrnews/auto-fetch v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Auto Fetch local/http

NPM version Coverage Scrutinizer Code Quality Quality Gate Status Bugs Code Smells Technical Debt Vulnerabilities Maintainability Rating Reliability Rating Security Rating

With this package you can get local or remote file data like the fetch method.

Example usage

import fetch '@hckrnews/auto-fetch'

const responseLocal = await fetch('./src/__fixtures__/example.json')
const responseRemote = await fetch('https://example.com')

Returns the body as string.

await response.text()

Returns the body parsed as JSON.

await response.json()

Returns the body as ReadableStream.

let result = ''
response.body.on('data', (chunk) => {
    result += chunk
})

response.body.on('end', () => {
    const data = JSON.parse(result)
})
1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago