0.0.9 • Published 1 year ago

grab-from v0.0.9

Weekly downloads
-
License
WTFPL
Repository
-
Last release
1 year ago

grab-from

Grab from using https. Or http. And hey, as from 0.0.4 0.0.5 it actually works. Ok, from 0.0.8 it actually works, and even follows redirection.

Usage

import grabFrom from 'grabfrom'

// grabbing from a site
const {binary, utf8, stream} = grabFrom('site.com')

// grab some files
const html = await utf8('/index.html')
const pic = await binary('/photo.jpg')
const clip = await stream('/movie.mp4')
// yes we do need to know what type to expect

Default is to use https. If http is needed then include that as the second parameter.

import grabFrom from 'grabfrom'
import http from 'node:http'

// use http
const {binary, utf8, stream} = grabFrom('site.com', http)

Default is also just to grab the response no matter what. If you care about errors then set the throw on error parameter to true:

import grabFrom from 'grabfrom'
import http from 'node:http'

// use http
const {binary, utf8, stream} = grabFrom('site.com', true)
// or
const {binary, utf8, stream} = grabFrom('site.com', http, true)
0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.1

2 years ago