Skip to content

Commit ff98dbb

Browse files
author
v1rtl
committed
bump deps
1 parent 34b84b5 commit ff98dbb

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

egg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"entry": "./mod.ts",
55
"description": "🦕🟦 A lightweight Deno HTTP client library for IPFS",
66
"homepage": "https://deno.land/x/http_compression",
7-
"version": "0.2.7",
7+
"version": "0.2.8",
88
"releaseType": null,
99
"unstable": true,
1010
"unlisted": false,

example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { compression } from './mod.ts'
2-
import { Server } from 'https://deno.land/std@0.148.0/http/server.ts'
2+
import { Server } from 'https://deno.land/std@0.167.0/http/server.ts'
33

44
const s = new Server({
55
handler: async (req) => {
@@ -13,5 +13,5 @@ const s = new Server({
1313

1414
s.listenAndServe()
1515
console.log(
16-
"Server available at http://localhost:3000 . Set Accept-Encoding header to 'gzip', for example, to get a compressed response."
16+
"Server available at http://localhost:3000. Set Accept-Encoding header to 'gzip', for example, to get a compressed response."
1717
)

mod.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { compress as brotli } from 'https://deno.land/x/[email protected]/mod.ts'
2-
import { deflate, gzip } from 'https://deno.land/x/[email protected]/mod.ts'
1+
import { readAll } from 'https://deno.land/[email protected]/streams/read_all.ts'
2+
import { compress as brotli } from 'https://deno.land/x/[email protected]/mod.ts'
3+
import { Foras, gzip, deflate } from 'https://deno.land/x/[email protected]/deno/mod.ts'
34
import { Accepts } from 'https://deno.land/x/[email protected]/mod.ts'
4-
import { readAll } from 'https://deno.land/[email protected]/streams/conversion.ts'
5+
6+
await Foras.initSyncBundledOnce()
57

68
const funcs = {
79
br: brotli,
@@ -46,17 +48,14 @@ export type CompressionOptions = {
4648
*
4749
* @example
4850
* ```ts
49-
*import { serve } from 'https://deno.land/[email protected]/http/server.ts'
50-
*import { compression } from 'https://deno.land/x/compression/brotli.ts'
51-
*
52-
*const s = serve({ port: 3000 })
53-
*
54-
*for await (const req of s) {
55-
* await compression({
56-
* path: 'README.md',
57-
* compression: ['gzip', 'deflate']
58-
* })(req)
59-
*}
51+
import { compression } from 'https://deno.land/x/http_compression/mod.ts'
52+
import { Server } from 'https://deno.land/[email protected]/http/server.ts'
53+
54+
new Server({
55+
handler: async (req) => {
56+
return await compression({ path, compression: ['br', 'gzip', 'deflate'] })(req)
57+
}, port: 3000
58+
}).listenAndServe()
6059
* ```
6160
*/
6261
export const compression =

0 commit comments

Comments
 (0)