sketch-module-fetch

1.0.0 • Public • Published

sketch-module-fetch

A fetch polyfill for sketch inspired by unfetch. It is automatically included (when needed) when using skpm.

Installation

npm i -S sketch-module-fetch

Usage

const fetch = require('sketch-module-fetch')

fetch("https://google.com")
  .then(response => response.text())
  .then(text => console.log(text))
  .catch(e => console.error(e))

extra add

upload file

const fetch = require('sketch-fetch-complete')

fetch("https://google.com",{
  method: 'post',
  // filepath of local file
  formdata: path,
  // form parameters
  formParameters: {
    name: 'sample',
    author: 'wwsun',
  }
})
  .then(response => response.text())
  .then(text => console.log(text))
  .catch(e => console.error(e))

Readme

Keywords

Package Sidebar

Install

npm i sketch-module-fetch

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.82 kB

Total Files

7

Last publish

Collaborators

  • wwsun