MCPcopy
hub / github.com/brimdata/zui / load

Method load

packages/zed-node/src/client.ts:12–35  ·  view source on GitHub ↗
(
    data: string | NodeJS.ReadableStream,
    opts: Partial<LoadOpts> = {}
  )

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 5

jsonHeaderFunction · 0.90
getLoadContentTypeFunction · 0.90
decodeFunction · 0.90
sendMethod · 0.80
toJSMethod · 0.65

Tested by

no test coverage detected