An error occurred when fs.createReadStream () put Buffer data into it.

clipboard.png
specific code such as the figure above
the whole code means to extract data from the database, cycle to see if the user has a base64-encoded avatar, and decode it into a buffer, and pass it to a readable stream. The reason why it is introduced into a readable stream here is that the Qiniuyun plug-in stipulates that it is a readable stream parameter.

Mar.23,2021

fs.createReadStream is not used to convert Buffer to ReadStream . Although it accepts a Buffer , there should still be a file path in Buffer . It just helps you decode the text.

the correct conversion from Buffer to ReadStream is as follows:

const stream = require('stream');
const bufferStream = new stream.PassThrough();
bufferStream.end(binaryData);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bade-34662.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bade-34662.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?