hyper-protocol.js
1 import fetchToHandler from './fetch-to-handler.js' 2 3 export default async function createHandler (options, session) { 4 return fetchToHandler(async () => { 5 const { default: hyperFetch } = await import('hypercore-fetch') 6 const SDK = await import('hyper-sdk') 7 8 const sdk = await SDK.create(options) 9 const fetch = await hyperFetch({ 10 sdk, 11 writable: true 12 }) 13 14 console.log({ sdk, fetch }) 15 16 fetch.close = () => sdk.close() 17 18 return fetch 19 }, session) 20 }