https://github.com/rzane/apollo-link-upload
:arrow_up: An Apollo Link for simpler file uploads
https://github.com/rzane/apollo-link-upload
absinthe apollo graphql phoenix rails upload
Last synced: 3 months ago
JSON representation
:arrow_up: An Apollo Link for simpler file uploads
- Host: GitHub
- URL: https://github.com/rzane/apollo-link-upload
- Owner: rzane
- Created: 2019-07-03T02:07:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T07:25:34.000Z (over 2 years ago)
- Last Synced: 2025-02-27T23:51:31.050Z (7 months ago)
- Topics: absinthe, apollo, graphql, phoenix, rails, upload
- Language: TypeScript
- Homepage:
- Size: 1.85 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
apollo-link-upload



This package can be used to perform file uploads. It is compatible with Absinthe and GraphQL::Extras.
### Features
- Written in TypeScript.
- Simple server-side implementation.
- Support for `FileList` and multiple file uploads.
- Supports React Native.### Supported Backends
- [Absinthe](https://hexdocs.pm/absinthe_plug/Absinthe.Plug.Types.html)
- [GraphQL::Extras](https://github.com/rzane/graphql-extras)## Usage
```javascript
import ApolloClient from "apollo-client";
import { createUploadLink } from "apollo-link-upload";const client = new ApolloClient({
link: createUploadLink({ uri: "/graphql" })
});
```### React Native
Values submitted in React Native will only be recognized as a file if it is an instance of `ReactNativeFile`.
```javascript
import { ReactNativeFile } from "apollo-link-upload";const file = new ReactNativeFile({
uri: "something",
name: "a.jpg",
type: "image/jpeg"
});
```## Similar Packages
- [`apollo-upload-client`](https://github.com/jaydenseric/apollo-upload-client)
- [`apollo-absinthe-upload-link`](https://github.com/bytewitchcraft/apollo-absinthe-upload-link)## Contributing
To install dependencies:
$ yarn install
To run the test suite:
$ yarn test