Socket
Book a DemoInstallSign in
Socket

fetch-task

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-task

fetch API as a Task.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

fetch-task Build Status

fetch API as a Task.

Install

$ npm install --save fetch-task

Usage

const fetchTask = require('fetch-task');

fetchTask('https://jsonplaceholder.typicode.com/users')
.rejectedMap(console.error)
.fork(console.warn, resp => resp[0]);

/*
^ Would log something like:
> { id: 1,
  name: 'Leanne Graham',
  username: 'Bret',
  email: 'Sincere@april.biz',
  address: 
   { street: 'Kulas Light',
     suite: 'Apt. 556',
     city: 'Gwenborough',
     zipcode: '92998-3874',
     geo: { lat: '-37.3159', lng: '81.1496' } },
  phone: '1-770-736-8031 x56442',
  website: 'hildegard.org',
  company: 
   { name: 'Romaguera-Crona',
     catchPhrase: 'Multi-layered client-server neural-net',
     bs: 'harness real-time e-markets' } }
*/

How different is it from normal fetch?

  • It's a Task!

  • It takes care of indentify the content-type and invokes the required consume body algorithm. (json, text, blob or buffer).

API

fetchTask(url)

url

Type: string

URL that needs to be fetched.

License

MIT © Hemanth.HM

Keywords

task

FAQs

Package last updated on 11 Dec 2016

Did you know?

Socket

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