1.1.4 • Published 1 year ago

snip-nsfw v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

NSFW API Wrapper

This is a Node.JS wrapper for the Snipcola NSFW wrapper. It provides an easy way to interact with the API endpoints and handle the response data.

Documentation

The full documentation can be found on the website.

Installation

Run this command:

npm install snip-nsfw

Dependencies

This project depends on:

  • node-fetch
  • await-to-js

To install them, run:

npm install node-fetch await-to-js

Usage

Example Usage:

// For non-modules, const api = require('snip-nsfw');
import api from 'snip-nsfw';

// getTypes(raw = false)
const { errors: typesErrors, data: { types } } = await api.getTypes();

if (!typesErrors) console.log(types);
/* 
*  [
*    "example",
*    "example2",
*    "example3"
*  ]
*/

// getListType(type, raw = false)
const { errors: listTypeErrors, data: listType } = await api.getListType(types[0] || 'example');

if (!listTypeErrors) console.log(listType);
/*
*  {
*    "path": "https://nsfw.snipcola.com/image/example",
*    "range": { min: 1, max: 1000 }
*  }
*/

// getImageURLs(types = 'all', amount = 1, raw = false)
const { errors: typeImagesErrors, data: typeImages } = await api.getImageURLs(types[0] || 'example', 1);

if (!typeImagesErrors) console.log(typeImages);
/*
*  {
*    "urls": [
*      "https://nsfw.snipcola.com/image/example/1"
*    ]
*  }
*/

// getImage(type = 'random', file = 'random', raw = false)
const { errors: imageErrors, data: image } = await api.getImage('random', 'random');

if (!imageErrors) console.log(image);
/*
* {
*   "type": "jpg",
*   "buffer": <Buffer ff d8 ff e0 00 ... 43704 more bytes>   
* }
*/
1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago