/
opt
/
canhelp
/
node_modules
/
openai
/
internal
/
/opt/canhelp/node_modules/openai/internal
mkdir
upload
Name
Size
Mode
Actions
decoders/
-
0755
rm
qs/
-
0755
rm
utils/
-
0755
rm
builtin-types.d.mts
2847
0644
edit
dl
rm
builtin-types.d.mts.map
1099
0644
edit
dl
rm
builtin-types.d.ts
2846
0644
edit
dl
rm
builtin-types.d.ts.map
1098
0644
edit
dl
rm
builtin-types.js
205
0644
edit
dl
rm
builtin-types.js.map
139
0644
edit
dl
rm
builtin-types.mjs
140
0644
edit
dl
rm
builtin-types.mjs.map
139
0644
edit
dl
rm
detect-platform.d.mts
749
0644
edit
dl
rm
detect-platform.d.mts.map
736
0644
edit
dl
rm
detect-platform.d.ts
748
0644
edit
dl
rm
detect-platform.d.ts.map
735
0644
edit
dl
rm
detect-platform.js
6200
0644
edit
dl
rm
detect-platform.js.map
4417
0644
edit
dl
rm
detect-platform.mjs
5922
0644
edit
dl
rm
detect-platform.mjs.map
4390
0644
edit
dl
rm
errors.d.mts
153
0644
edit
dl
rm
errors.d.mts.map
210
0644
edit
dl
rm
errors.d.ts
152
0644
edit
dl
rm
errors.d.ts.map
209
0644
edit
dl
rm
errors.js
1539
0644
edit
dl
rm
errors.js.map
1370
0644
edit
dl
rm
errors.mjs
1375
0644
edit
dl
rm
errors.mjs.map
1348
0644
edit
dl
rm
headers.d.mts
917
0644
edit
dl
rm
headers.d.mts.map
648
0644
edit
dl
rm
headers.d.ts
916
0644
edit
dl
rm
headers.d.ts.map
647
0644
edit
dl
rm
headers.js
2745
0644
edit
dl
rm
headers.js.map
2523
0644
edit
dl
rm
headers.mjs
2528
0644
edit
dl
rm
headers.mjs.map
2491
0644
edit
dl
rm
parse.d.mts
796
0644
edit
dl
rm
parse.d.mts.map
851
0644
edit
dl
rm
parse.d.ts
792
0644
edit
dl
rm
parse.d.ts.map
850
0644
edit
dl
rm
parse.js
2685
0644
edit
dl
rm
parse.js.map
2240
0644
edit
dl
rm
parse.mjs
2509
0644
edit
dl
rm
parse.mjs.map
2239
0644
edit
dl
rm
request-options.d.mts
2519
0644
edit
dl
rm
request-options.d.mts.map
1361
0644
edit
dl
rm
request-options.d.ts
2513
0644
edit
dl
rm
request-options.d.ts.map
1360
0644
edit
dl
rm
request-options.js
474
0644
edit
dl
rm
request-options.js.map
355
0644
edit
dl
rm
request-options.mjs
328
0644
edit
dl
rm
request-options.mjs.map
341
0644
edit
dl
rm
shim-types.d.mts
873
0644
edit
dl
rm
shim-types.d.mts.map
852
0644
edit
dl
rm
shim-types.d.ts
872
0644
edit
dl
rm
shim-types.d.ts.map
851
0644
edit
dl
rm
shim-types.js
202
0644
edit
dl
rm
shim-types.js.map
133
0644
edit
dl
rm
shim-types.mjs
137
0644
edit
dl
rm
shim-types.mjs.map
133
0644
edit
dl
rm
shims.d.mts
1051
0644
edit
dl
rm
shims.d.mts.map
614
0644
edit
dl
rm
shims.d.ts
1048
0644
edit
dl
rm
shims.d.ts.map
613
0644
edit
dl
rm
shims.js
3431
0644
edit
dl
rm
shims.js.map
2271
0644
edit
dl
rm
shims.mjs
3125
0644
edit
dl
rm
shims.mjs.map
2238
0644
edit
dl
rm
stream-utils.d.mts
428
0644
edit
dl
rm
stream-utils.d.mts.map
224
0644
edit
dl
rm
stream-utils.d.ts
427
0644
edit
dl
rm
stream-utils.d.ts.map
223
0644
edit
dl
rm
stream-utils.js
1338
0644
edit
dl
rm
stream-utils.js.map
868
0644
edit
dl
rm
stream-utils.mjs
1198
0644
edit
dl
rm
stream-utils.mjs.map
858
0644
edit
dl
rm
to-file.d.mts
2216
0644
edit
dl
rm
to-file.d.mts.map
1048
0644
edit
dl
rm
to-file.d.ts
2214
0644
edit
dl
rm
to-file.d.ts.map
1047
0644
edit
dl
rm
to-file.js
3721
0644
edit
dl
rm
to-file.js.map
3080
0644
edit
dl
rm
to-file.mjs
3569
0644
edit
dl
rm
to-file.mjs.map
3078
0644
edit
dl
rm
tslib.js
3089
0644
edit
dl
rm
tslib.mjs
1080
0644
edit
dl
rm
types.d.mts
6231
0644
edit
dl
rm
types.d.mts.map
3657
0644
edit
dl
rm
types.d.ts
6230
0644
edit
dl
rm
types.d.ts.map
3656
0644
edit
dl
rm
types.js
197
0644
edit
dl
rm
types.js.map
123
0644
edit
dl
rm
types.mjs
132
0644
edit
dl
rm
types.mjs.map
123
0644
edit
dl
rm
uploads.d.mts
1926
0644
edit
dl
rm
uploads.d.mts.map
1312
0644
edit
dl
rm
uploads.d.ts
1922
0644
edit
dl
rm
uploads.d.ts.map
1311
0644
edit
dl
rm
uploads.js
6151
0644
edit
dl
rm
uploads.js.map
5384
0644
edit
dl
rm
uploads.mjs
5573
0644
edit
dl
rm
uploads.mjs.map
5276
0644
edit
dl
rm
utils.d.mts
278
0644
edit
dl
rm
utils.d.mts.map
114
0644
edit
dl
rm
utils.d.ts
270
0644
edit
dl
rm
utils.d.ts.map
113
0644
edit
dl
rm
utils.js
653
0644
edit
dl
rm
utils.js.map
216
0644
edit
dl
rm
utils.mjs
363
0644
edit
dl
rm
utils.mjs.map
123
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/openai/internal/to-file.js
(3721B)
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toFile = toFile; const uploads_1 = require("./uploads.js"); const uploads_2 = require("./uploads.js"); /** * This check adds the arrayBuffer() method type because it is available and used at runtime */ const isBlobLike = (value) => value != null && typeof value === 'object' && typeof value.size === 'number' && typeof value.type === 'string' && typeof value.text === 'function' && typeof value.slice === 'function' && typeof value.arrayBuffer === 'function'; /** * This check adds the arrayBuffer() method type because it is available and used at runtime */ const isFileLike = (value) => value != null && typeof value === 'object' && typeof value.name === 'string' && typeof value.lastModified === 'number' && isBlobLike(value); const isResponseLike = (value) => value != null && typeof value === 'object' && typeof value.url === 'string' && typeof value.blob === 'function'; /** * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats * @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible * @param {Object=} options additional properties * @param {string=} options.type the MIME type of the content * @param {number=} options.lastModified the last modified timestamp * @returns a {@link File} with the given properties */ async function toFile(value, name, options) { (0, uploads_2.checkFileSupport)(); // If it's a promise, resolve it. value = await value; // If we've been given a `File` we don't need to do anything if (isFileLike(value)) { if (value instanceof File) { return value; } return (0, uploads_1.makeFile)([await value.arrayBuffer()], value.name); } if (isResponseLike(value)) { const blob = await value.blob(); name || (name = new URL(value.url).pathname.split(/[\\/]/).pop()); return (0, uploads_1.makeFile)(await getBytes(blob), name, options); } const parts = await getBytes(value); name || (name = (0, uploads_1.getName)(value)); if (!options?.type) { const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type); if (typeof type === 'string') { options = { ...options, type }; } } return (0, uploads_1.makeFile)(parts, name, options); } async function getBytes(value) { let parts = []; if (typeof value === 'string' || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. value instanceof ArrayBuffer) { parts.push(value); } else if (isBlobLike(value)) { parts.push(value instanceof Blob ? value : await value.arrayBuffer()); } else if ((0, uploads_1.isAsyncIterable)(value) // includes Readable, ReadableStream, etc. ) { for await (const chunk of value) { parts.push(...(await getBytes(chunk))); // TODO, consider validating? } } else { const constructor = value?.constructor?.name; throw new Error(`Unexpected data type: ${typeof value}${constructor ? `; constructor: ${constructor}` : ''}${propsForError(value)}`); } return parts; } function propsForError(value) { if (typeof value !== 'object' || value === null) return ''; const props = Object.getOwnPropertyNames(value); return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; } //# sourceMappingURL=to-file.js.map
Save
cmd:
run