# sfetch

> fetch package

Latest version **1.0.1** (published 2017-11-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install sfetch
pnpm add sfetch
yarn add sfetch
bun add sfetch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-11-07 |
| First published | 2017-08-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jichuangwei |
| Maintainers | jichuangwei |

## Links

- npm: https://www.npmjs.com/package/sfetch
- Repository: https://github.com/JCW0811/sfetch
- Homepage: https://github.com/JCW0811/sfetch#readme
- Issues: https://github.com/JCW0811/sfetch/issues
- npm.io page: https://npm.io/package/sfetch

## Dependencies (1)

- [user](https://npm.io/package/user.md) 0.0.0

## Recent versions

- 1.0.1 (latest) — 2017-11-07
- 0.3.4 — 2017-08-30
- 0.3.3 — 2017-08-25
- 0.3.2 — 2017-08-24
- 0.3.1 — 2017-08-24
- 0.2.1 — 2017-08-24
- 0.1.1 — 2017-08-24
- 0.1.0 — 2017-08-23
- 0.0.2 — 2017-08-23
- 0.0.1 — 2017-08-23

## README

# Sfetch

- package [fetch](http://github.github.io/fetch/ "fetch")

- response add field **'json'** to save backend data otherwise add field **'text'**

- body make **object** to JSON.stringify(object)

- body suppport FormData or JSON (use FormData set daetaType:'formdata')

- method support **GET POST PATH DELETE**

- support timeout (default not set)

- support header (but fetch Request header field Authorization is not allowed)

## Usage

`    npm install sfetch --save`

`	import sfetch from 'sfetch'`

## Example

####  GET
       sfetch.get({
            url: url,
            body: body,//Object
	        timeout: 5000
        }).then((response) => {
        //response include 'json' field
        },(response)=>{
        //response include 'text' field
	    });
#### POST
         sfetch.post({
             url: url,
             body: body,//Object or FormData
             dataType : 'formdata',// body is FormData
			   timeout: 5000
         }).then((response) => {
             //response include 'json' field
          },(response)=>{
             //response include 'text' field
          });
#### PATH
###### the same as POST
#### DELETE
###### the same as POST

####Welcome to star , Thanks

---
_Source: https://npm.io/package/sfetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
