Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

@r26d/absinthe-apollo-upload-middleware

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@r26d/absinthe-apollo-upload-middleware

A network interface for Apollo that enables file-uploading to Absinthe back ends reduced to just middleware to make it easier to work with.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Table of Contents generated with DocToc

@r26d/absinthe-apollo-upload-middleware

A network interface for Apollo that enables file-uploading to Absinthe back ends reduced to just middleware to make it easier to work with.

Usage

This branch is for Apollo V3

I simplified this to just be the middleware. That allows you to use other middleware to handle the other issues related to the request.

import ApolloClient from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { createUploadMiddleware } from 'apollo-absinthe-upload-link'
import { ApolloLink } from 'apollo-link'

const client = new ApolloClient({
link: ApolloLink.from([
createUploadMiddleware,
createHttpLink({
uri: 'localhost:4000/graphqql',
credentials: 'include'
})
])
})

Usage with React Native

Substitute File with ReactNativeFile:

import { ReactNativeFile } from 'apollo-absinthe-upload-link'

const file = new ReactNativeFile({
uri: '…',
type: 'image/jpeg',
name: 'photo.jpg'
})

const files = ReactNativeFile.list([
{
uri: '…',
type: 'image/jpeg',
name: 'photo-1.jpg'
},
{
uri: '…',
type: 'image/jpeg',
name: 'photo-2.jpg'
}
])

License

MIT :copyright: r26D LLC

Acknowledgements

API

ReactNativeFileObject

A React Native FormData file object.

Type: Object

Properties

ReactNativeFile

A React Native file.

Parameters

Creates an array of file instances.

Parameters

Examples

const files = ReactNativeFile.list([{
  uri: uriFromCameraRoll1,
  type: 'image/jpeg',
  name: 'photo-1.jpg'
}, {
  uri: uriFromCameraRoll2,
  type: 'image/jpeg',
  name: 'photo-2.jpg'
}])

FAQs

Package last updated on 25 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts