The fs
package can’t handle foreign characters in the file name of a zipped file, eg the German Umlaut ö.
Does anyone know an alternative to the fs
package that has createReadStream
functionality and can handle foreign characters?
This is the LOC that throws the error:
const fileType = await fileTypeFromStream(fs.createReadStream(fileInfo.filePath));
Error: ENOENT: no such file or directory, open 'assets/app/37_J_Göttel_Chrom_Autoso_20161205.csv.zip'
Thanks in advance!
ky kynect@a4xrbj1 ,
To handle filenames with foreign characters more reliably, especially in scenarios involving zipped files and streams, you might consider using the yauzl package along with iconv-lite for character encoding support.
First of all Install Required Packages then Adjust your code to use yauzl
. Ensure you handle file type detection (file-type
package in this example) appropriately within the read stream processing. Implement robust error handling to manage various scenarios like file not found (ENOENT
) or encoding issues.