How to use get-it - 1 common examples

To help you get started, we’ve selected a few get-it examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / preview-nextjs-landing-pages-studio / src / components / previews / pdf / BusinessCard.js View on Github external
/* eslint-disable react/no-unused-prop-types, react/no-multi-comp, react/no-did-mount-set-state, react/forbid-prop-types */
import React from 'react'
import PropTypes from 'prop-types'
import Spinner from 'part:@sanity/components/loading/spinner'
import sanityClient from 'part:@sanity/base/client'
import imageUrlBuilder from '@sanity/image-url'
import getIt from 'get-it'
import promise from 'get-it/lib/middleware/promise'
import styles from './BusinessCard.css'

const fileType = 'png'
const cardServiceHost = '' // 'http://localhost:3000'
const cardServiceBaseUrl = `${cardServiceHost}/api/business-card`
const request = getIt([promise()])

const builder = imageUrlBuilder(sanityClient)

const urlFor = source => {
  return builder.image(source)

let memoizedDocument = null

const arrayBufferToBase64 = arrbuf => {
  return btoa(new Uint8Array(arrbuf).reduce((data, byte) => data + String.fromCharCode(byte), ''))

class BusinessCard extends React.PureComponent {
  static propTypes = {
    document: PropTypes.object


Generic HTTP request library for node, browsers and workers

Latest version published 3 days ago

Package Health Score

86 / 100
Full package analysis

Popular get-it functions