File Tulis Streaming NodeJS

const readFile: InstanceType<typeof stream.Readable> = new stream.Readable({
  read() {
    return true
  }
})
readFile
  .pipe(fs.createWriteStream(`${process.env.IMG_DIR}/${Date.now().toString()}-${file.originalname}`))
  .on('finish', Promise.resolve)
  .on('error', Promise.reject)
Restu Wahyu Saputra