Having issues getting ext/mime type from certain files
Closed this issue · 2 comments
jessejamesblack commented
Hello, we are having issues getting the file ext from certain files like this
The file is a pdf file but reads as a binary file. When getting the fileType like this its undefined.
const stream = got.stream(presignedURL);
promises.push(fileType.fromStream(stream));
sindresorhus commented
Confirmed.
However:
❯ file 1000503577.pdf
1000503577.pdf: data
The file
command line tool is usually able to detect valid PDFs.
sindresorhus commented
Actually, you have corrupted the PDF. It starts with unrelated data:
--fa92d6cf-98aa-4886-8eeb-667d510d131a..Content-Disposition: form-data; name=file; filename="test document - doc upload.pdf"; filename*=utf-8''test%20document%20-%20doc%20upload.pdf....