# sketch-request

> request module for sketch plugin

Latest version **1.0.1** (published 2018-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install sketch-request
pnpm add sketch-request
yarn add sketch-request
bun add sketch-request
```

## 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 | 2018-06-12 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zobor |
| Maintainers | zobor |
| Keywords | sketch-request, request |

## Links

- npm: https://www.npmjs.com/package/sketch-request
- Repository: https://github.com/zobor/sketch-request
- Homepage: https://github.com/zobor/sketch-request#readme
- Issues: https://github.com/zobor/sketch-request/issues
- npm.io page: https://npm.io/package/sketch-request

## Dependencies (1)

- [cocoascript-class](https://npm.io/package/cocoascript-class.md) ^0.1.2

## Recent versions

- 1.0.1 (latest) — 2018-06-12
- 1.0.0 — 2018-06-12

## README

# Sketch Request

A request module for sketch plugin
-------

## Install
```
npm install sketch-request -S
```

## Usage
```
const request = require('sketch-request')
request(url, options)
```

## Options

* method {String} GET/POST http re
* body {String} POST body
* headers {Object} request headers
* args {Object} POST FormData 
* files {String} path to the upload file

## Example

Upload Image
```js
const request = require('sketch-request')
request('https://test.oss-cn-hangzhou.aliyuncs.com/',{
    method: "post",
    headers: {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
    },
    args: {
        id: 1000
    },
    files: {
        file: '/Users/zobor/1.png'
    }
}).then(rs=>{
	console.log(rs.json())
})
```

Post Data
```js
const request = require('sketch-request')
request('https://test.oss-cn-hangzhou.aliyuncs.com/',{
    method: "post",
    headers: {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
    },
    body: JSON.stringify({
        username: 'zobor',
        password: '123456'
    }),
}).then(rs=>{
	console.log(rs.json())
})

```

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