Discussions

Ask a Question
Back to All

Node SDK - FileStore & Response

Hi,

I've been trying to use the .convert method of the SDK to convert any file to txt without storing the converted file on the server. However, I haven't managed to structure the request properly and have resorted to this:

  async parseFromUrl(url: string): Promise<string> {
    // this.client is in this case ConvertAPI()
    const response = await this.client.convert('txt', {
      File: url,
    })

    const urlTxt = response.files[0].url

    const content = await axios
      .get(urlTxt, { responseType: 'text' })
      .then(response => response.data)

    return content
  }

How do I structure my request so that I get the converted data directly in the .convert request response?