Socket
Socket
Sign inDemoInstall

@hckrnews/auto-fetch

Package Overview
Dependencies
7
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hckrnews/auto-fetch

Auto Fetch local/http


Version published
Maintainers
2
Created

Readme

Source

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

Keywords

FAQs

Last updated on 21 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc