With this package you can get local file data like the fetch method.
import localFetchfrom '@hckrnews/local-fetch'
const fetch = await localFetcher('file:///Users/pieter.wigboldus/projects/local-fetch/src/__fixtures__/example.json')
Returns the body as string.
fetch.text()
Returns the body parsed as JSON.
fetch.json()
Returns the body as ReadableStream.
let result = ''
fetch.body.on('data', (chunk) => {
result += chunk
})
fetch.body.on('end', () => {
const data = JSON.parse(result)
})