Skip to content

Commit

Permalink
chore: apply readmeio/api#820
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown committed Oct 14, 2024
1 parent e3a6a2b commit 4caf5e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/api-core/src/lib/prepareParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ import type {ReadStream} from 'node:fs'
import type {Operation} from 'oas/operation'
import type {ParameterObject, SchemaObject} from 'oas/types'

import fs from 'node:fs'
import path from 'node:path'
import stream from 'node:stream'

import caseless from 'caseless'
import DatauriParser from 'datauri/parser.js'
import datauri from 'datauri/sync.js'
// `get-stream` is included in our bundle, see `tsup.config.ts`
// eslint-disable-next-line import/no-extraneous-dependencies
import {getStreamAsBuffer} from 'get-stream'
Expand Down Expand Up @@ -78,10 +74,14 @@ function merge(src: unknown, target: unknown) {
* into a parameters object for making an API request.
*
*/
function processFile(
async function processFile(
paramName: string | undefined,
file: ReadStream | string,
): Promise<{base64?: string; buffer?: Buffer; filename: string; paramName?: string} | undefined> {
const fs = await import('node:fs')
const path = await import('node:path')
const {default: DatauriParser} = await import('datauri/parser.js')
const {default: datauri} = await import('datauri/sync.js')
if (typeof file === 'string') {
// In order to support relative pathed files, we need to attempt to resolve them.
const resolvedFile = path.resolve(file)
Expand Down

0 comments on commit 4caf5e2

Please sign in to comment.