curl.enable with Easy
I need to use curl.enable(CurlFeature.NoDataParsing) or curl.enable.(CurlFeature.Raw) with Easy and Multi.
I've tried everything for 2 days and I can't find a solution.
The Easy and Multi classes are basically a 1:1 conversion of the C libcurl API, thus they do not provide this helper.
This should not be needed for the native Easy and Multi instances, because they don't parse the data. The data is provided as-is the same way libcurl provides it in the CURLOPT_WRITEFUNCTION.
What are you trying to accomplish?
If you want a behavior similar to what is done in the Curl class, take a look at the default write function that is used:
https://github.com/JCMais/node-libcurl/blob/96201eba595042fa0838e81b381caa2fa6384184/lib/Curl.ts#L963-L977
And then in the onEnd function that is called when the Multi instance marks the easy handle as finished:
https://github.com/JCMais/node-libcurl/blob/96201eba595042fa0838e81b381caa2fa6384184/lib/Curl.ts#L102
https://github.com/JCMais/node-libcurl/blob/96201eba595042fa0838e81b381caa2fa6384184/lib/Curl.ts#L323-L382
@JCMais Vi que é do Brasil, sou até do mesmo estado que ti.
Fiz alguns testes e somente com Curl os dados veem e gravo em arquivo e os caracteres ficam como o esperado.
Já utilizando Easy e Multi faço o tratamento e gravação da mesma forma e os caracteres por algum motivo são aparentemente convertidos para utf8.
Estou fazendo uma conexão intermitente em câmeras de captura de placas de veículos, onde a cada passagem a camera da um retorno com os dados. Por se tratarem de dados brutos contendo informações e o conteúdo de jpg possui muitos caracteres especiais.
Parte de dados que estou recebendo do mesmo trecho:
Curl: ÿØÿà JFIF
Easy e Multi: ÿؿࠐJFIF
Coloca um sample de código de como vc está fazendo o parseamento usando a classe Easy
Meu problema foi solucionado alterando está linha: https://github.com/JCMais/node-libcurl/blob/96201eba595042fa0838e81b381caa2fa6384184/lib/Curl.ts#L336
Para:
const data = isDataParsingEnabled ? dataRaw : dataRaw
Não é a melhor abordagem, mas não encontrei outra solução.