https://github.com/jane/gql-compress
Shrink your GraphQL
https://github.com/jane/gql-compress
compress gql graphql
Last synced: 4 months ago
JSON representation
Shrink your GraphQL
- Host: GitHub
- URL: https://github.com/jane/gql-compress
- Owner: jane
- License: mit
- Created: 2018-12-19T02:54:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T02:39:15.000Z (over 3 years ago)
- Last Synced: 2025-07-04T23:41:34.116Z (12 months ago)
- Topics: compress, gql, graphql
- Language: TypeScript
- Homepage: http://npm.im/gql-compress
- Size: 3.29 MB
- Stars: 3
- Watchers: 24
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# gql-compress
Shrink your GraphQL
](https://npm.im/gql-compress) [](https://circleci.com/gh/jane/gql-compress) [](https://coveralls.io/github/jane/gql-compress?branch=master)
----
# Installation
`npm i gql-compress`
# Usage
```javascript
import compress from 'gql-compress'
const uncompressed = `
query {
repository(owner:"octocat", name:"Hello-World") {
issues(last:20, states:CLOSED) {
edges {
node {
title
url
labels(first:5) {
edges {
node {
name
}
}
}
}
}
}
}
}
` // 357 bytes
const compressed = compress(uncompressed) // 147 bytes
// outputs: "query{repository(owner:\"octocat\",name:\"Hello-World\"){issues(last:20,states:CLOSED){edges{node{title url labels(first:5){edges{node{name}}}}}}}}"
```
Example from [GitHub](https://developer.github.com/v4/guides/forming-calls/).
[MIT](./LICENSE.md)