@nupt/sketch-fetch

A fetch for sketch

Usage no npm install needed!

<script type="module">
  import nuptSketchFetch from 'https://cdn.skypack.dev/@nupt/sketch-fetch';
</script>

README

@nupt/sketch-fetch

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

Installation

npm i -S @nupt/sketch-fetch

Usage

const fetch = require('@nupt/sketch-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))