Skip to content

Commit

Permalink
fix: gitHub cached images not displaying fully (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuciNyan authored Mar 5, 2024
1 parent b5f4d66 commit 8c57ad6
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/pixel-profile-server/src/github-stats.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { CONSTANTS, parseArray, parseBoolean, parseString } from './utils'
import { Hono } from 'hono'
import { stream } from 'hono/streaming'
import { clamp, fetchStats, renderStats } from 'pixel-profile'

const githubStats = new Hono()

githubStats.get('/', async (c) => {
const { req, res } = c
const { req, res, body } = c
const {
background,
cache_seconds = `${CONSTANTS.CARD_CACHE_SECONDS}`,
Expand Down Expand Up @@ -64,16 +63,8 @@ githubStats.get('/', async (c) => {
}

const result = await renderStats(stats, options)
const resultUint8Array = Uint8Array.from(result)

return stream(c, async (stream) => {
// Write a process to be executed when aborted.
stream.onAbort(() => {
console.log('Aborted!')
})
// Write a Uint8Array.
await stream.write(resultUint8Array)
})
return body(result)
} catch (err) {
console.log(err)

Expand Down

0 comments on commit 8c57ad6

Please sign in to comment.