Package

purescript-milkis

Repository
justinwoo/purescript-milkis
License
MIT
Uploaded by
justinwoo

Build Status

A wrapper around node-fetch for fetch requests through Node.

Aptly named for the greatest soft drink of all time, Milkis.

Installation

npm install --save node-fetch

bower install --save purescript-milkis

Usage

See the tests

Example Usage

I use Milkis in my ytcasts project in order to download HTML from a Youtube page:

downloadCasts ::
  forall e.
  DBConnection ->
  Url ->
  Aff
    (Program e)
    (Array CastStatus)
downloadCasts conn (Url url) = do
  res <- text =<< fetch url defaultFetchOptions
  case getCasts res of
    Right casts -> for casts $ downloadCast conn
    Left e -> do
      errorShow e
      pure []