async function* filePart(id, origin, input) {
    var _a;
    const filename = (_a = input.filename) !== null && _a !== void 0 ? _a : `${origin}.${getExt(origin)}`;
    if (filename.includes("\r") || filename.includes("\n")) {
        throw new Error(`File paths cannot contain carriage-return (\\r) \
or newline (\\n) characters! Filename for property '${origin}' was:
"""
${filename}
"""`);
    }
    yield enc.encode(`content-disposition:form-data;name="${id}";filename=${filename}\r\n\r\n`);
    const fileData = input[platform_node_js_1.inputFileData];
    // handle buffers, file paths, and streams:
    if (fileData instanceof Uint8Array)
        yield fileData;
    else if (typeof fileData === "string")
        yield* await (0, platform_node_js_1.streamFile)(fileData);
    else
        yield* fileData;
}
/** Turns an InputFile into a generator of `Uint8Array`s */
Turns an InputFile into a generator of `Uint8Array`s
Turns an InputFile into a generator of ` Uint8Array ` s
async function* filePart(id, origin, input) {
    var _a;
    const filename = (_a = input.filename) !== null && _a !== void 0 ? _a : `${origin}.${getExt(origin)}`;
    if (filename.includes("\r") || filename.includes("\n")) {
        throw new Error(`File paths cannot contain carriage-return (\\r) \
or newline (\\n) characters! Filename for property '${origin}' was:
"""
${filename}
"""`);
    }
    yield enc.encode(`content-disposition:form-data;name="${id}";filename=${filename}\r\n\r\n`);
    const fileData = input[platform_node_js_1.inputFileData];
    if (fileData instanceof Uint8Array)
        yield fileData;
    else if (typeof fileData === "string")
        yield* await (0, platform_node_js_1.streamFile)(fileData);
    else
        yield* fileData;
}
async function * filePart ( id , origin , input ) { var _a ; const filename = ( _a = input . filename ) !== null && _a !== void 0 ? _a : ` ${ origin } ${ getExt ( origin ) } ` ; if ( filename . includes ( "\r" ) || filename . includes ( "\n" ) ) { throw new Error ( ` \\ \
 \\ ${ origin } ${ filename } ` ) ; } yield enc . encode ( ` ${ id } ${ filename } \r \n \r \n ` ) ; const fileData = input [ platform_node_js_1 . inputFileData ] ; if ( fileData instanceof Uint8Array ) yield fileData ; else if ( typeof fileData === "string" ) yield * await ( 0 , platform_node_js_1 . streamFile ) ( fileData ) ; else yield * fileData ; }
Turns an InputFile into a generator of `Uint8Array`s
Turns an InputFile into a generator of ` Uint8Array ` s
// handle buffers, file paths, and streams: