(
data: string | NodeJS.ReadableStream,
opts: Partial<LoadOpts> = {}
)
| 10 | public fetch = globalThis.fetch.bind(globalThis); |
| 11 | |
| 12 | async load( |
| 13 | data: string | NodeJS.ReadableStream, |
| 14 | opts: Partial<LoadOpts> = {} |
| 15 | ) { |
| 16 | const { pool } = opts; |
| 17 | if (!pool) throw new Error("Missing required option 'pool'"); |
| 18 | const poolId = typeof pool === 'string' ? pool : pool.id; |
| 19 | const branch = opts.branch || 'main'; |
| 20 | const headers: Record<string, string> = {}; |
| 21 | if (opts.message) headers['Zed-Commit'] = jsonHeader(opts.message); |
| 22 | const res = await this.send({ |
| 23 | path: `/pool/${poolId}/branch/${encodeURIComponent(branch)}`, |
| 24 | method: 'POST', |
| 25 | // eslint-disable-next-line |
| 26 | // @ts-ignore |
| 27 | body: data, |
| 28 | duplex: 'half', |
| 29 | headers, |
| 30 | contentType: getLoadContentType(opts.format) ?? '', |
| 31 | signal: opts.signal, |
| 32 | timeout: Infinity, |
| 33 | }); |
| 34 | return decode(await res.json()).toJS(); |
| 35 | } |
| 36 | } |
nothing calls this directly
no test coverage detected